akhauriyash/Code-Regression huggingface dataset:
class c:
    def __init__(self):
        self.d = {}

    def insert(self,s):
        self.d[s] = 1

    def find(self,s):
        try:
            if self.d[s]:
                print('yes')
        except KeyError:
            print('no')


n = int(input())
d = c()
for i in range(n):
    s,k = input().split()
    if s == 'insert':
        d.insert(k)
    else:
        d.find(k)


Measured memory_bytes: 33108
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n, m = ns()
    s = list(input())

    ans = []

    idx = n
    while idx != 0:
        exitFlg = True
        for i in range(min(idx, m), 0, -1):
            if s[idx - i] == "0":
                idx -= i
                ans.append(i)
                exitFlg=False
                break

        if exitFlg:
            print(-1)
            exit(0)

    ans.reverse()
    print(*ans, sep=" ")


if __name__ == '__main__':
    main()


Measured memory_bytes: 96080
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int N;
int K;
int main() {
    int i, j, h[100005], d[100005];
    cin >> N>> K;
    h[0]=0;
    d[1]=0;
    d[0]=1000000000;
    for(i=1;i<=N;i++)
        cin>>h[i];
    for (i = 2; i <= N; i++) {
        d[i]=1000000000;
        for(j=i-1;j>=i-K&&j>=1;j--)
        d[i]=min(d[i],d[j]+abs(h[i]-h[j]));
    }
    cout<<d[N];
}

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

int main() {
  long long n, k; cin >> n >> k;
  long long out = 0;
  for(long long i = k; i < n + 2; i++){
    out += (i * (n - i + 1) + 1) % 1000000007;
  }
  cout << out % 1000000007;
}


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

int main()
{
string S;    
cin>>S;
    
if (S[0]=='1'  && S[1]=='1' && S[2]=='1'){
 cout<<3<<endl;   
}
else if(S[0]=='0' && S[1]=='0' && S[2]=='0'){
 cout<<0<<endl;   
}
else if( (S[0]=='1' && S[1]=='0' && S[2]=='0') ||
       (S[0]=='0' && S[1]=='1'  && S[2]=='0') ||         
       (S[0]=='0' && S[1]=='0'  && S[2]=='1') ){
 cout<<1<<endl;   
}
else  {
cout<<2<<endl;
}
}



Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000000
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<double,int> P;
double xs,ys,xt,yt;
int n;
double x[1002],y[1002],r[1002];
vector<P> e[1002];
double dist[1002];
bool visit[1002];
priority_queue<P, vector<P>, greater<P>> q;
int main(){
    cin>>xs>>ys>>xt>>yt;
    cin>>n;
    x[0]=xs;y[0]=ys;r[0]=0;
    x[n+1]=xt;y[n+1]=yt;r[n+1]=0;
    rep(i,n) cin>>x[i+1]>>y[i+1]>>r[i+1];
    n+=2;
    rep(i,n){
        dist[i]=INF;
        for (int j=i+1;j<n;j++){
            double d=max(0.0,sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-r[i]-r[j]);
            e[i].pb(mp(d,j));
            e[j].pb(mp(d,i));
        }
    }
    q.push(mp(0,0));
    while(!q.empty()){
        double d=q.top().first;
        int node=q.top().second;
        q.pop();
        visit[node]=true;
        for (auto y:e[node]){
            if (!visit[y.second]){
                if (dist[y.second]>d+y.first){
                    dist[y.second]=d+y.first;
                    q.push(mp(dist[y.second],y.second));
                }
            }
        }
    }
    cout<<fixed<<setprecision(10)<<dist[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 20756
package main

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

func main() {
        var n, k int
        fmt.Scan(&n, &k)
        sc := bufio.NewScanner(os.Stdin)
        sc.Split(bufio.ScanWords)
        kinds := map[int]int{}
        for i := 0; i < n; i++ {
                sc.Scan()
                a, _ := strconv.Atoi(sc.Text())
                kinds[a]++
        }
        nums := make([]int, 0, len(kinds))
        for _, n := range kinds {
                nums = append(nums, n)
        }
        sort.Sort(sort.IntSlice(nums))
        sum := 0
        for i := 0; i < len(kinds)-k; i++ {
                sum += nums[i]
        }
        fmt.Printf("%d\n", sum)
}

Measured memory_bytes: 14208
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int h, a;
    cin >> h >> a;
    cout << ceil((double)h / a) << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace AOJ.ITP
{
    public class CardGame
    {
        public static void Main()
        {
            int turn = int.Parse(Console.ReadLine());

            int taro = 0;
            int hanako = 0;
            for (int i = 0; i < turn; i++)
            {
                var input = Console.ReadLine().Split(' ');
                string s_taro = input[0];
                string s_hanako = input[1];
                if (s_taro == s_hanako)
                {
                    taro++;
                    hanako++;
                }
                else
                {
                    string s = input.OrderBy(x => x).First();
                    if (s == s_taro) { hanako += 3; }
                    else { taro += 3; }
                }
            }
            Console.WriteLine(taro + " " + hanako);
        }
    }
}

Measured memory_bytes: 7088
package main

import "fmt"
import "sort"

func main() {
	var A, B, C, K int
	fmt.Scanf("%d %d %d\n%d\n", &A, &B, &C, &K)
	s := sort.IntSlice{A, B, C}
	s.Sort()
	for i := 0; i < K; i++ {
		s[2] *= 2
	}
	fmt.Println(s[0] + s[1] + s[2])
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    string s; cin >> s;
    deque<char> dq;
    REP(i, s.size()){
        dq.push_back(s[i]);
    }
    int Q; cin >> Q;
    bool front = true;
    REP(i, Q){
        int T; cin >> T;
        if(T==1){
            front = !front;
        } else {
            int f; cin >>f;
            char c; cin >>c;
            if( (front and f==1) or (!front and f==2)){
                dq.push_front(c);
            } else {
                dq.push_back(c);
            }
        }
    }
    vector<char> res(dq.size());
    REP(i, dq.size()){
        res[i] = dq[i];
    }
    if(front){
        REP(i, res.size()){
            cout << res[i];
        }
    } else {
        for(int i=res.size()-1; i>=0; i--){
            cout << res[i];
        }
    }
    cout << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec A(N+1);
    REP(i,1,N+1) cin >> A[i];

    ll cnt = 0;
    REP(i,1,N+1) {
        if(i % 2 == 1 && A[i] % 2 == 1) ++cnt;
    }
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)    scanf("%d",&x)
#define sl(x)    scanf("%lld",&x)
#define ss(s)    scanf("%s",s)
#define pi(x)    printf("%d\n",x)
#define pl(x)    printf("%lld\n",x)
#define ps(s)    printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pl;
typedef vector<int>       vi;
typedef vector<ll>        vl;
typedef vector<pii>       vpii;
typedef vector<pl>        vpl;
typedef vector<vi>        vvi;
typedef vector<vl>        vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
#define MAXN   20000001 
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}

int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;



void solve(){
    
    ll x,y;
    cin>>x>>y;
    double k=(double)y/x;
    if(k>2 && k<4)
    {
       while(x>0 && y>0 && k!=2)
       {
        y-=4;
        --x;
        k=(double)y/x;
       }
       if( k==2)
       {
        cout<<"Yes"<<endl;
       }
       else
       {
        cout<<"No"<<endl;
       }
    }
    else if(k==2 || k==4)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }

}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t = 1;
   // cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

vl g[N];


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

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

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


Measured memory_bytes: 10656
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(N)]
CD = [list(map(int,input().split())) for i in range(M)]

for i in range(N):
    ans = 0
    a,b = AB[i]
    tmp = float("inf")
    for j in range(M):
        c,d = CD[j]
        if abs(a-c)+abs(b-d) < tmp:
            tmp = abs(a-c)+abs(b-d)
            ans = j+1
    print(ans)

Measured memory_bytes: 39408
#include<iostream>

using namespace std;

int main(void){
  int A, B, C, K;
  cin >> A >> B >> C;
  cin >> K;

  for (int i = 0; i < K; i++) {
    if (C <= B) {
      C *= 2;
    }
    else if (B <= A) {
      B *= 2;
    }
  }

  if (A < B && B < C){
    cout << "Yes"<< endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3132
import numpy as np

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

mean_x = int(sum(x_s)/n)
a_s = [(x - mean_x)**2 for x in x_s]
a = sum(a_s)
b_s = [(x - mean_x - 1)**2 for x in x_s]
b = sum(b_s)

if a < b:
    print(a)
else:
    print(b)


Measured memory_bytes: 12440
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

class Point {
 public:
  double x, y;

  Point(double x = 0, double y = 0): x(x), y(y) {}

  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }

  double abs() { return sqrt(norm()); }
  double norm() {return x * x + y * y; }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }

};

typedef Point Vector;

double dot(Vector a, Vector b) {
  return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
  return a.x * b.y - a.y * b.x;
}

struct Segment {
  Point p1, p2;
};

typedef Segment Line;

class Circle {
 public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};

Point project(Segment s, Point p) {
  Vector base = s.p2 - s.p1;
  double r = dot(p - s.p1, base) / base.norm();
  return s.p1 + base * r;
}

pair<Point, Point> getCrossPoints(Circle c, Line l) {
  Vector e = (l.p2 - l.p1) / (l.p2 - l.p1).abs();
  Vector pr = project(l, c.c);
  double base = sqrt(c.r * c.r - (pr - c.c).norm());
  return make_pair(pr + e * base, pr - e * base);
}

int main() {
  Circle c;
  cin >> c.c.x >> c.c.y >> c.r;
  int n;
  cin >> n;
  cout << fixed;
  for (int i = 0; i < n; i++) {
    Line l;
    cin >> l.p1.x >> l.p1.y >> l.p2.x >> l.p2.y;
    pair<Point, Point> result = getCrossPoints(c, l);
    if (result.first.x < result.second.x) {
      cout << setprecision(10) << result.first.x << " " << result.first.y << " " << result.second.x << " " << result.second.y << endl;
    } else if (result.first.x == result.second.x && result.first.y < result.second.y) {
      cout << setprecision(10) << result.first.x << " " << result.first.y << " " << result.second.x << " " << result.second.y << endl;
    } else {
      cout << setprecision(10) << result.second.x << " " << result.second.y << " " << result.first.x << " " << result.first.y << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3292
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include<stack>
#include<queue>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int res=0;
    for(int i=1;i<=n;i++)
    {
        int count =0;
        for(int j=1;j<=n;j++)
        {
            if(i%j==0&&j%2!=0)
            {
                count=count+1;
            }
        }
        if(count==8)
        {
            res=res+1;
        }
    }
    printf("%d\n",res);
}


Measured memory_bytes: 384
using System;

namespace B_009_52
{
    internal class Program
    {
        private static void Main(string[] args)
        {
    
            new Logic_B().Start();//
       
        }

        public class Logic_B
        {
            public void Start()
            {
                var num = Console.ReadLine();
                var str = Console.ReadLine();

                var x = 0;
                var max = 0;
                for (int i = 0; i < str.Length; i++)
                {
                    if (str[i] == 'I')
                    {
                        x++;
                    }

                    if (str[i] == 'D')
                    {
                        x--;
                    }
                    max = Math.Max(x, max);
                }
                Console.WriteLine(max);
            }
        }

    }
}

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

int main(){
 int m, f, r;

 while(1) {
  cin >> m >> f >> r;

  if ((m == -1 && f == -1) && r == -1) break;

  if (m == -1 || f == -1) cout << "F" << endl;
  else if (m + f >= 80) cout << "A" << endl;
  else if (m + f >= 65) cout << "B" << endl;
  else if (m + f >= 50) cout << "C" << endl;
  else if (m + f >= 30) {
   if (r >= 50) cout << "C" << endl;
   else cout << "D" << endl;
  } else cout << "F" << endl;
 }

 return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<iomanip>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int main(){
    int a,b,x;
    cin >> a >> b >> x;
    if(a <= x && x <= a+b){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}



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

int main(void){
    ll n, d; cin >> n >> d;
  int ans = 0;
  for(int i = 0; i < n; i++){
  	ll x, y; cin >> x >> y;
    if(x * x + y * y <= d * d) ans++;
  }
  cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>
#include <cstring>

using namespace std;

int dp[500000][26];
int z[500000][20];

void makeTable(const string& s){
	int n = s.size();
	memset(dp, -1, sizeof(dp));
	memset(z, -1, sizeof(z));
	for(int i=n-1;i>=0;i--){
		dp[i][s[i]-'a'] = i+1;
		int dst = i+1;
		for(int j=s[i]-'a'+1;j<26;j++){
			if(dst < n && dp[dst][j-1] != -1){
				dp[i][j] = dp[dst][j-1];
				dst = dp[dst][j-1];
			} else {
				break;
			}
		}
		if(dp[i][25] != -1 && dst < n && dp[dst][25] != -1 && dp[dst][25] < n){
			dst = dp[dst][25];
			if(dst < n){
				for(int j=0;j<s[i]-'a';j++) dp[i][j] = dp[dst][j];
			}
		}
		// cout << i << ":";
		// for(int j=0;j<26;j++) cout << dp[i][j] << " ";
		// cout << endl;
	}
	for(int i=n-1;i>=0;--i){
		if(dp[i][25] != -1){
			z[i][0] = dp[i][25];
			int c = 1;
			int dst = dp[i][25];
			while(dst < n && z[dst][c-1] != -1){
				z[i][c] = z[dst][c-1];
				dst = z[i][c];
				++c;
			}
		}
		// cout << i << ":";
		// for(int j=0;j<z[i].size();j++) cout << z[i][j] << " "; cout << endl;
	}
}

string query(int l, int r){
	int chk = 19;
	while(chk > 0){
		while(chk >= 0 && z[l][chk] == -1) --chk;
		if(chk <= 0) return "No";
		while(chk >= 0 && z[l][chk] > r) --chk;
		if(chk <= 0) return "No";
		if(z[l][chk] == r) return "Yes";
		l = z[l][chk];
	}
	return chk > 0 ? "Yes" : "No";
}

int main(){
	string s;
	while(cin >> s){
		makeTable(s);
		int Q; cin >> Q;
		for(int i=0;i<Q;i++){
			int l, r; cin >> l >> r;
			--l;
			cout << query(l, r) << endl;
		}
	}
}


Measured memory_bytes: 91140
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def PrimeFactorization(x):
    def plist(x):
        if x < 2: return []
        if x & 1 == 0: return [2] + plist(x >> 1)
        for p in range(3, x + 1, 2):
            if x % p == 0: return [p] + plist(x // p)
            if p ** 2 > x: return [x]

    pl = plist(x)
    pp, ee = [], []
    for p in pl:
        if not pp or p != pp[-1]:
            pp += [p]
            ee += [0]
        ee[-1] += 1
    return [(p, e) for p, e in zip(pp, ee)]

def gcd(a,b):
    while b:a,b=b,a%b
    return a

def main():
    a,b=MI()
    g=gcd(a,b)
    pe=PrimeFactorization(g)
    print(len(pe)+1)

main()

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

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(),(a).rend())
#define ll long long
#define pb(a) push_back(a)

#define PRINTV(v) {for(ll deB=0; deB<(v).size(); deB++){cout << (v)[deB] << " ";}cout << endl;}

int main(){
	ll N;
	cin >> N;
	
	ll ret = 0;
	
	while(N!=0){
		if (N%10 == 2) ret++;
		N /= 10;
	}
	
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll Inf = 1 << 30;
const int maxx = 3e5 + 8;

priority_queue <ll> qua;
priority_queue <ll, vector<ll>, greater<ll> > que;
int n;
ll a[maxx];
ll suml[maxx], sumr[maxx];
ll s1, s2;

int main() {

	/*ll ss[6] = {0, 2, 4, 5, 3, 1};
	for(int i = 1; i <= 5; i++) que.push(ss[i]);
	while(!que.empty()) {
		cout << que.top() << endl;
		que.pop(); //1 2 3 4 5
		//qua.pop(); //5 4 3 2 1
	}*/

	scanf("%d", &n);
	for(int i = 1; i <= n * 3; i++) {
		scanf("%lld", &a[i]);
		if(i <= n) {
			s1 += a[i];
			que.push(a[i]);
		}
		else if(i >= 2 * n + 1) {
			s2 += a[i];
			qua.push(a[i]);
		}
	}
	suml[n] = s1;
	for(int i = n + 1; i <= n * 2; i++) {
		if(a[i] > que.top()) {
			s1 -= que.top();
			s1 += a[i];
			que.pop();
			que.push(a[i]);
		}
		suml[i] = s1;
	}
	sumr[2 * n + 1] = sumr[2 * n] = s2;
	for(int i = n * 2 - 1; i >= n; i--) {
		if(a[i + 1] < qua.top()) {
			s2 -= qua.top();
			s2 += a[i + 1];
			qua.pop();
			qua.push(a[i + 1]);
		}
		sumr[i] = s2;
	}
	ll ans = -Inf;
	/*for(int i = n + 1; i <= n * 2; i++) {
		cout << suml[i] << " " << sumr[i] << endl;
	}*/
	for(int i = n; i <= n * 2; i++) ans = max(ans, suml[i] - sumr[i]);
	if(ans == -Inf) ans = suml[n] - sumr[n];
	printf("%lld\n", ans);
}

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

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin>>s;
  set<char>sajol;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]>='a' && s[i]<='z')
    {
      sajol.insert(s[i]);
    }
  }
  if(sajol.size()==s.length()) printf("yes\n");
  else printf("no\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M (((int)1e9)+7)
long long powmod(long long x,int n)
{
	if(n==0)	return 1;
	if(n&1)	return (x*powmod((x*x)%M,n/2))%M;
	return powmod((x*x)%M,n/2)%M;
}
int main() {
    // your code goes here
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    long long n;
    cin>>n;
    cout<<(((powmod(10,n)-2*powmod(9,n)+powmod(8,n))%M)+M)%M;
    return 0;
}

Measured memory_bytes: 3656
N = int(input())
h = [int(x) for x in input().split()]
dp = [0]*N

for i in range(1,N):
    if i==1:
        dp[i] = abs(h[1]-h[0])
    elif i>1:
        dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2])

print(dp[N-1])

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

using namespace std;

int main(){
	int a[4][4];bool b[4][4]={false};
	int i,j,k,l;
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>a[i][j];
		}
	}
	cin>>k;
	int c[k+1];
	for(int l=1;l<=k;l++){
		cin>>c[l];
		for(int i=1;i<=3;i++){
			for(int j=1;j<=3;j++){
				if(c[l]==a[i][j])b[i][j]=true;
			}
		}
	}
	if(b[1][1]==true&&b[1][2]==true&&b[1][3]==true){cout<<"Yes";return 0;}
	if(b[2][1]==true&&b[2][2]==true&&b[2][3]==true){cout<<"Yes";return 0;}
	if(b[3][1]==true&&b[3][2]==true&&b[3][3]==true){cout<<"Yes";return 0;}
	if(b[1][1]==true&&b[2][1]==true&&b[3][1]==true){cout<<"Yes";return 0;}
	if(b[1][2]==true&&b[2][2]==true&&b[3][2]==true){cout<<"Yes";return 0;}
	if(b[1][3]==true&&b[2][3]==true&&b[3][3]==true){cout<<"Yes";return 0;}
	if(b[1][1]==true&&b[2][2]==true&&b[3][3]==true){cout<<"Yes";return 0;}
	if(b[1][3]==true&&b[2][2]==true&&b[3][1]==true){cout<<"Yes";return 0;}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
l = len(s)
m = len(t)
maxi = 0
for i in range(l-m+1):
    t1 = s[i:i+m]
    x = 0
    for j in range(m):
        if t1[j] == t[j]:
            x = x + 1
    if maxi < x:
        maxi = x

mini = m - maxi

print(mini)


Measured memory_bytes: 8832
import sys
from collections import deque


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

graph = [[] for _ in range(n+1)]

for i in range(m):
 a, b = map(int, input().split())
 graph[a].append(b)
 graph[b].append(a)

dist = [-1] * (n+1)
dist[0] = 0
dist[1] = 0

q = [0] * (n+1)
q[0] = -1

d = deque()
d.append(1)

while d:
    v = d.popleft()
    for i in graph[v]:
        if dist[i] != -1:
            continue
        dist[i] = v
        d.append(i)

ans = dist[2:]
if -1 in ans:
    print('No')
    exit()
else:
    print('Yes')
    print(*ans, sep="\n")
    exit

Measured memory_bytes: 99412
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn solve(n: i32, a: Vec<i32>) -> i32 {
    let mut vec = a;
    vec.sort_by(|x, y| x.cmp(y).reverse());
    let alice = vec
        .iter()
        .enumerate()
        .filter(|&(i, _)| i % 2 == 0)
        .map(|(_, &i)| i)
        .sum::<i32>();
    let bob = vec
        .iter()
        .enumerate()
        .filter(|&(i, _)| i % 2 == 1)
        .map(|(_, &i)| i)
        .sum::<i32>();

    alice - bob
}

fn main() {
    input!{
        n: i32,
        a: [i32; n]
    }
    println!("{}", solve(n, a))
}


Measured memory_bytes: 4352
import 'dart:io';
import 'dart:convert';

main() async {
  int N = int.parse(stdin.readLineSync());
  var lines = stdin.transform(utf8.decoder).transform(LineSplitter());
  var S = []..length = N;
  var d = new Map();
  int counter = 0;
  await for (var line in lines) {
    var tmp = line;
    if (d.containsKey(tmp))
      d[tmp] += 1;
    else
      d[tmp] = 1;
    counter++;
    if (counter == N) break;
  }
  print(d.length);
}


Measured memory_bytes: 96936
H,W=map(int,input().split())
A=[]
indh=[]
indw=[]
A=[list(input()) for _ in range(H)]   
for i in reversed(range(H)):
    if set(A[i])==set('.'):
        A.pop(i)
import numpy as np
AT=list(np.array(A).T)
ansT=[]
for i in range(W):
    if set(AT[i])!=set('.'):
        ansT.append(AT[i])
for a in list(np.array(ansT).T):
    print(''.join(a))

Measured memory_bytes: 12500
n=int(input())
H=[]
S=[]
C=[]
D=[]
list=[]
cards=[0]*52
cards=[]
for i in range(n):
    n,a=input().split()
    a=int(a)
    if n=="S":
        S.append(a)
    elif n=="H":
        H.append(a)
    elif n=="C":
        C.append(a)
    else:
        D.append(a)
for i in range(1,14):
    if i in S:
        x=0
    else:
        print("S",i)
for i in range(1,14):
    if i in H:
        x=0
    else:
        print("H",i)
for i in range(1,14):
    if i in C:
        x=0
    else:
        print("C",i)
for i in range(1,14):
    if i in D:
        x=0
    else:
        print("D",i)
        


Measured memory_bytes: 5604
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

L = []
idx = 1
C = []

for a in A:
    for i in range(a):
        C.append(idx)
    idx += 1
idx = 0
for h in range(H):
    L.append([])
    for w in range(W):
        L[-1].append(str(C[idx]))
        idx += 1
    if h % 2 == 1:
        L[-1] = [e for e in reversed(L[-1])]

for l in L:
    print(' '.join(l))



Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a, b, x, tmp1, tmp2;
  cin >> a >> b >> x;
  if(a==0)
    tmp1=0;
  else tmp1=(a-1)/x+1;
  tmp2=b/x+1;
  cout << tmp2-tmp1;
  return 0;
}

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

static class Program
{
    static long[] Solve(int N, int[] A)
    {
        var ans = new long[N];
        var tuples = Enumerable.Range(0, N).Select(i => Tuple.Create(A[i], i)).OrderByDescending(tuple => tuple.Item1).ToArray();
        int min = int.MaxValue;
        for (int i = 0; i < N; ++i)
        {
            min = Math.Min(tuples[i].Item2, min);
            int a = tuples[i].Item1;
            int b = (i + 1 < N) ? tuples[i + 1].Item1 : 0;
            ans[min] += Math.BigMul(a - b, i + 1);
        }
        return ans;
    }

    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int[] A = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        foreach (long ans in Solve(N, A))
        {
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 36572
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int cun = a + b + c;
	if (max(a, max(b, c)) == cun - max(a, max(b, c)))
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

Measured memory_bytes: 3580
local mce, mfl, msq, mmi, mma = math.ceil, math.floor, math.sqrt, math.min, math.max
local mab = math.abs
local n = io.read("*n")
local w = {}
for i = 1, n do w[i] = io.read("*n") end
local sum = {}
sum[1] = w[1]
for i = 2, n do
  sum[i] = sum[i - 1] + w[i]
end
local dif = mab((sum[n] - sum[1]) - sum[1])
for i = 2, n - 1 do
  local adif = mab((sum[n] - sum[i]) - sum[i])
  dif = mmi(dif, adif)
end
print(dif)


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
 
using namespace std;
 
#define eb emplace_back
#define pb push_back
#define MP make_pair
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define rep(i,j,n) for (int i = j; i < n; ++i)
#define repn(i,j,n) for (int i = j; i <= n; ++i)
#define revn(i,j,n) for (int i = j; i >= n; --i)
#define sz(i) i.size()
#define mem(i,v) memset(i,v,sizeof(i))
#define all(v) v.begin(), v.end()
#define endl '\n'
#define int long long
#define INF 1e18
#define ss second
#define ff first

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
//const int mod=1e9+7;
const int mod=998244353;
const int up=1e5+10;
const int MAXN=1e6+10;

// int n,m,x,y,res=0,sz[2*up],par[2*up],ans[2*up];

// int get(int x)
// {
//     return x*(x-1)/2;
// }

// int find(int x)
// {
//     if(par[x]==x)
//         return x;
//     else
//         return par[x]=find(par[x]);
// }

// void merge(int u,int v)
// {
//     x=find(u);
//     y=find(v);
//     if(sz[x]<sz[y])
//         swap(x,y);
//     res-=get(sz[x]);
//     res-=get(sz[y]);
//     sz[x]+=sz[y];
//     res+=get(sz[x]);
//     par[v]=u;
// }

// void solve()
// {
//     cin>>n>>m;
//     vector<pii>q(m+1);
//     vector<pair<int,pii>>e(n);
//     repn(i,1,n)
//     {
//         sz[i]=1;
//         par[i]=i;
//     }
//     repn(i,1,n-1)
//     {
//         cin>>e[i].ss.ff>>e[i].ss.ss>>e[i].ff;
//     }
//     repn(i,1,m)
//     {
//         cin>>q[i].ff;
//         q[i].ss=i;
//     }
//     sort(all(e));
//     sort(all(q));
//     int pos=1;
//     repn(i,1,m)
//     {
//         while(pos<n && e[pos].ff<=q[i].ff)
//         {
//             x=e[pos].ss.ff;
//             y=e[pos].ss.ss;
//             merge(x,y);
//             ++pos;
//         }
//         ans[q[i].ss]=res;
//     }
//     repn(i,1,m)
//     {
//         cout<<ans[i]<<" ";
//     }
//     cout<<endl;
// }


int dep[2*up],a[2*up];
void solve()
{
    int n;
    cin>>n;
    repn(i,0,n)
    {
        cin>>a[i];
    }
    revn(i,n,0)
    {
        if(i==n)
            dep[i]=a[i];
        else
            dep[i]=dep[i+1]+a[i];
    }
    int cur=1,ans=0;
    repn(i,0,n)
    {
        
        if(cur<0)
        {
            cout<<-1<<endl;
            return;
        }
        //cout<<cur<<" "<<dep[i+1]<<endl;
        ans+=min(cur,dep[i]);
        cur-=a[i];
        cur=cur*2;
        cur=min(cur,((int)1e15));
        if(cur<0)
        {
            cout<<-1<<endl;
            return;
        }
    }
    cout<<ans<<endl;
}

int32_t main()
{
    int t;
    // memset(prime, true, sizeof(prime)); 
    // sieve();
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
}



Measured memory_bytes: 5168
#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 pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
int main() {
 // 入力
    int N, A;
    cin >> N >> A;

    // 処理
    int L = A;
    int R = A + N - 1;

    int eat;
    if (R <= 0)
        eat = R;
    else if (L >= 0)
        eat = L;
    else
        eat = 0;

    int answer = (R + L) * (R - L + 1) / 2 - eat;

    // 出力
    cout << answer << endl;

    return 0;

}


Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*

val pw = PrintWriter(System.out)

fun main(args: Array<String>) {
    val n = readInt()
    val s = read().split(" ").distinct()
    println(if(s.size == 4) "Four" else "Three")
    pw.flush()
}

fun inputList() = 
    readLine()!!.split(" ").map(String::toInt)

fun sum_digits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

/****** Decrared Functions ******/

// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }


fun println(value : Any) {
    pw.println(value)
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)


Measured memory_bytes: 36084
#include <bits/stdc++.h>
using namespace std;
int main(){
    set<string> s;
    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        string temp;
        cin >> temp;
        s.insert(temp);
    }
    cout << s.size();
    return 0;
}


Measured memory_bytes: 19256
#include<iostream>
#include<utility>
#include<climits>
using namespace std;

int main()
{
	int a, b;

	while(cin >> a >> b)
	{ 

	int sum = a + b;

	int keta;

	if (sum / 1000000 >= 1) keta = 7; 
	else if (sum / 100000 >= 1) keta = 6; 
	else if (sum / 10000 >= 1) keta = 5; 
	else if (sum / 1000 >= 1) keta = 4; 
	else if (sum / 100 >= 1) keta = 3; 
	else if (sum / 10 >= 1) keta = 2;
	else keta = 1;

	cout << keta << endl;

	}

	return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;

namespace ABC133
{
    class Program
    {
        static int Main(string[] args)
        {
            problemB();
            return 0;
        }

        static void problemB()
        {
            string[] input1 = Console.ReadLine().Split(' ');
            int n = int.Parse(input1[0]);
            int dim = int.Parse(input1[1]);

            var xList = new List<int>[n];
            for (int i = 0; i < n; i++)
            {
                xList[i] = new List<int>();
            }
            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                
                for(int j = 0; j < dim; j++)
                {
                    xList[i].Add(int.Parse(input[j]));
                }
            }

            int ans = 0;

            for (int i_1 = 0; i_1 < n-1; i_1++)
            {               
                for (int i_2 = i_1+1; i_2 < n; i_2++)
                {
                    double dist = 0;
                    for (int j = 0; j < dim; j++)
                    {
                        dist += Math.Pow(xList[i_1][j] - xList[i_2][j],2);
                    }
                    dist = Math.Sqrt(dist);
                    if(Math.Floor(dist) == Math.Ceiling(dist))
                    {
                        ans += 1;
                    }
                }
            }

            Console.WriteLine(ans);

        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
struct iofix
{
   ios_base::Init i;
   iofix() {
      cin.sync_with_stdio(0);
      cin.tie(0);
      cout.sync_with_stdio(0);
      cout.tie(0);
      cout.precision(10);
      cout << fixed;
   }
} iofix;

void solve(){
  int64_t a, b, c, d; cin >> a >> b >> c >> d;
  cout << max(a*c ,max(b*d, max(a*d, max(a*c, b*c))));
}

int main(){


   	solve();

#ifndef Time
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
   return 0;
}

Measured memory_bytes: 3840
import java.util.*;
import java.util.stream.*;
import java.io.*;

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in1 = br.readLine().split(" ");
        String[] in2 = br.readLine().split(" ");
        int N = Integer.parseInt(in1[0]);
        int K = Integer.parseInt(in1[1]);
        br.close();

        if(K >= N) {
            System.out.println(0);
            System.exit(0);
        }

        List<Long> H = Arrays.stream(in2)
                        .mapToLong(Long::parseLong)
                        .sorted()
                        .boxed().collect(Collectors.toList());
        
        long sum = 0;
        for(int i = 0; i < N - K; i++){
            sum += H.get(i);
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 67488
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <complex>
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
using namespace std;
typedef long long ll;

ll powMod(ll a, ll n, ll mod){
    if(n == 0) return 1;
    if(n%2 == 0)
        return powMod(a, n/2, mod) * powMod(a, n/2, mod) % mod;
    else
        return a * powMod(a, n-1, mod)% mod;
}

ll factMod(ll n, ll mod){
    ll ret = 1;
    for(ll i = 1; i <= n; ++i){
        ret *= i;
        ret %= mod;
    }
    return ret;
}

ll ncrMod(ll n, ll r, ll mod){
    ll x=1, y=1;
    for(ll i = 1; i <= r; ++i){
        x *= n-i+1;
        x %= mod;
        y *= i;
        y %= mod;
    }
    return x * powMod(y, mod-2, mod) % mod;
}

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    const ll mod = 1000000007;
    ll ans = powMod(2,n,mod);
    ans -= 1;

    ans = (ans - ncrMod(n, a, mod)) % mod;
    ans = (ans - ncrMod(n, b, mod)) % mod;
    if(ans < 0) ans += mod;
    ans %= mod;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize
    }
    if n <= 999 {
        println!("ABC");
    } else {
        println!("ABD");
    }
}


Measured memory_bytes: 4352
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int N, K;
	scanf("%d%d", &N, &K);
	int *X = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &X[i]);
	}
	int sum = 0;
	for (int i = 0; i < N; i++) {
		if (X[i] < (K - X[i])) {
			sum += X[i]*2;
		}
		else {
			sum += (K - X[i]) * 2;
		}
	}
	int ans = sum;
	printf("%d\n", ans);





#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 128
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var k = int.Parse(Console.ReadLine());
            var s = Console.ReadLine().Trim();

            if(s.Length <= k){
                Console.WriteLine(s);
            }else{
                Console.WriteLine(s.Substring(0, k) + "...");
            }
        }
    }
}


Measured memory_bytes: 27548
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
long long a[200005];
long long sum[200005];
int main()
{
	int i, n;
	long long ans = 0;
	scanf("%d", &n);
	for(i = 1 ; i <= n ;i++)
	{
		scanf("%lld", &a[i]);
	}
	for(i = 2 ; i <= n ; i++)
	{
		if(a[i] == 1) ans++;
		else
		{
			if(a[i] - 1 == a[i - 1]) ans ++;
			else ans += a[i];
		}
	}
	int vis = 1;
	if(a[1] != 0) vis = 0;
	for(i = 2 ; i <= n ; i++)
	{
		if(a[i] - a[i - 1] > 1)
		{
			vis = 0;
		}
	}
	if(vis == 0) printf("-1\n");
	else
	{
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a1, b1, a2, b2; cin >> a1 >> b1 >> a2 >> b2;
    cout << (a2 - a1 ? 1 : 0);
}


Measured memory_bytes: 892
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a<13){
    if(a<=5){
      ou(0);
      return 0;
    }
    ou(b/2);
    return 0;
  }
  if(a>=13)ou(b);
  
}

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 n, m;
  cin >> n >> m;
  vector<int> l(m);
  vector<int> r(m);
  rep(i,m){
    int tmp;
    cin >> tmp;
    l.at(i)=tmp;
    cin >> tmp;
    r.at(i)=tmp;
  }
  int ans;
  ans = *min_element(r.begin(), r.end()) - *max_element(l.begin(), l.end()) + 1;
  if (ans < 0) ans = 0;
  cout << ans;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
ki = [0] * (n+1)

for i in range(m):
        a, b = map(int, input().split())
        ki[a] += 1
        ki[b] -= 1
cant = 0
for i in range(n):
        ki[i+1] += ki[i]
        if ki[i+1]%2: cant = 1
print("YNEOS"[cant::2])

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

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int a, b;
    cin >> a >> b;
    
    for(int i=1; i<=3; i++)
        if(i * a * b % 2)
        {
            cout << "Yes\n";
            return 0;
        }

    cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a==1&&b==2 || a==2&&b==1)
    {
        printf("3\n");
    }
    else if(a==1&&b==3||a==3&&b==1)
    {
        printf("2\n");
    }
    else if(a==2&&b==3 || a==3&&b==2)
    {
        printf("1\n");
    }
}


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

int main() {
    int n, k;
    cin >> n >> k;
    ll a[n];
    rep(i, n) cin >> a[i];

    for (int i = 0; i < n - k; i++) {
        if (a[i] < a[i + k])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 5192