akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF (int)(1e9+10)
#define LLINF (lint)(1e18+10)

using namespace std;

int main(){
    int n, c, k;
    cin >> n >> c >> k;
    vector<int> t(n);
    rep(i, n){
        cin >> t[i];
    }
    SORT(t);
    int ans = 1, tmp = t[0], j = 0;
    rep(i, n){
        if(i - j + 1 > c || t[i] - tmp > k){
            ans++;
            tmp = t[i];
            j = i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#define bi(x) (1<<(x-1))
#define rep(i,j,k) for (i=j;i<=k;i++)
#define down(i,j,k) for (i=j;i>=k;i--)
using namespace std;
const int N=2e5+5,K=20,Sn=1<<19;
int n,sn,V,v,k,i,j,lef,rig;
int a[N],c[N],l[N],r[N];
int rr[N][K],ls[Sn],rs[Sn];
void work(int *r,int *rs)
{
	int i,j,v=V;
	rep(j,1,k)
	{
		rr[n][j]=n;
		down(i,n-1,1)
			if (abs(a[i+1]-a[i])<=v) rr[i][j]=rr[i+1][j];
			else rr[i][j]=i;
		v>>=1;
	}
	rep(i,1,n) r[i]=rr[i][1];
	rep(i,0,sn) rs[i]=0;
	rep(i,0,sn-1)
	{
		rep(j,2,k)
			if (!(i&bi(j)))
				rs[i^bi(j)]=max(rs[i^bi(j)],rr[rs[i]+1][j]);
	}	
}
int main()
{
//	freopen("camel.in","r",stdin);
//	freopen("camel.out","w",stdout);
	scanf("%d%d",&n,&V);
	rep(i,1,n) scanf("%d",&a[i]);	
	for (k=1,v=V;v>0;v>>=1) k++;
	
	sn=(1<<k)-1;
	work(r,rs);
	reverse(a+1,a+1+n);
	work(l,ls);
	
	rep(i,1,n) l[i]=n-l[i]+1;
	reverse(l+1,l+1+n);
	
	rep(i,0,sn) {
		lef=rs[i]; rig=n-ls[sn^i]+1;
		if (rig-lef<=1) c[1]++;
		else if (r[lef+1]>=rig-1) {
			c[l[lef+1]]++; c[r[lef+1]+1]--;
		}
	}
	rep(i,1,n) {
		c[i]+=c[i-1];
		if (c[i]>0) printf("Possible\n");
		else printf("Impossible\n");
	}
	return 0;
}

Measured memory_bytes: 25216
#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

signed main()
{
    int x, y;

    cin >> x >> y;

    if (y % 2 == 1)
    {
        cout << "No" << endl;
        return 0;
    }

    if (x * 2 <= y && y <= x * 4)
    {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ll MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll N;
    cin>>N;
    
    ll ans=0,i=1;
    while(true){
        //sl(ans,i)
        if(ans>=N){
            cout<<i-1;break;
        }
        ans+=i;
        i++;
    }
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


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

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            abc064_b();
        }

        static void abc064_b()
        {
            // B - Traveling AtCoDeer Problem
            int n = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            int ans = A.Max() - A.Min();
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int) (n); i++)
#define _GLIBCXX_DEBUG

const int MAX_d = 10, INF = 1e8;
int d, g, p[MAX_d], c[MAX_d];
int ans = INF;
int main(){
    cin >> d >> g;
    rep(i, d) cin >> p[i] >> c[i];

    for(int bit = 0; bit < (1 << d); bit++){
        bitset<MAX_d> e(bit);
        int sum=0, cnt=0, maxPtr=-1;
        rep(i, d){
            if(e.test(i)){
                sum += c[i] + (i+1)*p[i]*100;
                cnt += p[i];
            }
        }
        int num=-1;
        rep(i, d){
            if(!e.test(i) && maxPtr < i){
                maxPtr = i;
                num = p[maxPtr];
            }
        }
        
        while(sum < g && num > 1){
            if(maxPtr == -1) break;
            sum += 100 * (maxPtr+1);
            num--;
            cnt++;
        }
        if(sum >= g && ans > cnt) ans = cnt;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
    
now = 1
nex = a[now-1]
ans = 0
flg = 0
while a[now-1] != 0:
    a[now-1], nex = 0, a[now-1]
    now = nex
    ans += 1
    if nex == 2:
        flg = 1
        break

if flg == 1:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 7084
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
const long long INF = 1e18;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
ll n; int a, b, c, d;
map <ll, ll> dp;
ll work(ll n) {
	if (dp.count(n)) return dp[n];
	ll &ans = dp[n]; ans = INF;
	if (1.0 * n * d < 1e18) ans = n * d;
	if (n == 0) return ans;
	chkmin(ans, a + (n % 2) * d + work(n / 2));
	chkmin(ans, a + (2 - n % 2) * d + work(n / 2 + 1));
	chkmin(ans, b + (n % 3) * d + work(n / 3));
	chkmin(ans, b + (3 - n % 3) * d + work(n / 3 + 1));
	chkmin(ans, c + (n % 5) * d + work(n / 5));
	chkmin(ans, c + (5 - n % 5) * d + work(n / 5 + 1));
	return ans;
}
int main() {
	int T; read(T);
	while (T--) {
		read(n), read(a), read(b), read(c), read(d);
		dp.clear(); cout << work(n) << endl;
	}
	return 0;
}


Measured memory_bytes: 4796
import std.stdio, std.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii, std.numeric, std.random;
import std.typecons, std.functional, std.traits,std.concurrency;
import std.algorithm, std.container;
import core.bitop, core.time, core.memory;
import std.bitmanip;
import std.regex;

enum INF = long.max/3;
enum MOD = 10L^^9+7;

//辞書順順列はiota(1,N),nextPermituionを使う


void end(T)(T v)
if(isIntegral!T||isSomeString!T||isSomeChar!T)
{
    import core.stdc.stdlib;
    writeln(v);
    exit(0);
}

T[] scanArray(T = long)()
{
    static char[] scanBuf;
    readln(scanBuf);
    return scanBuf.split.to!(T[]);
}

dchar scanChar()
{
    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    return cast(dchar)c;
}

T scanElem(T = long)()
{
    import core.stdc.stdlib;
    static auto scanBuf = appender!(char[])([]);

    scanBuf.clear;

    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    while (!isWhite(c) && c != -1)
    {
        scanBuf ~= cast(char) c;
        c = getchar;
    }
    return scanBuf.data.to!T;
}

dchar[] scanString(){
    return scanElem!(dchar[]);
}


void main()
{
  auto R = scanElem;
  auto G = scanElem;
  writeln(G*2-R);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin >>n;
  int arr[n],dp[n];
  int i;
  for(i=0;i<n;i++)
    cin >>arr[i];
  dp[0]=0;
  if(n>=2)
  dp[1]=abs(arr[1]-arr[0]);
  for(i=2;i<n;i++)
    dp[i]=min((dp[i-1]+abs(arr[i]-arr[i-1])),(dp[i-2]+abs(arr[i]-arr[i-2])));
               cout <<dp[n-1]<<endl;
}

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

int main() {

    int mod = 1000000000+7;
    int h, w;
    cin >> h >> w;
    int arr[h][w], t[h][w];
    for (int i=0; i<h; i++) {
        string s;
        char l;
        cin >> s;
        for (int j=0; j<w; j++) {
            l = s[j];
            arr[i][j] = (l == '#');
        }
    }
    t[0][0] = 1;
    for (int i=1; i<w; i++) {
        t[0][i] = ((arr[0][i] == 1) ? 0: t[0][i-1]) % mod;
    }
    for (int i=1; i<h; i++) {
        t[i][0] = ((arr[i][0] == 1) ? 0: t[i-1][0]) % mod;
    }
    for (int i=1; i<h; i++) {
        for (int j=1; j<w; j++) {
            t[i][j] = ((arr[i][j] == 1) ? 0: t[i-1][j] + t[i][j-1]) % mod;
        }
    }
    cout << t[h-1][w-1] % mod;
    

}

Measured memory_bytes: 8064
fun main(args: Array<String>) {
    var N= nextInt()
    val dp = IntArray(N + 1) { 1000000007 }
    dp[0] = 0
    for (n in 1 .. N) {
        var power = 1
        while (power <= n) {
            dp[n] = Math.min(dp[n], dp[n - power] + 1)
            power *= 6
        }
    }
    for (n in 1 .. N) {
        var power = 1
        while (power <= n) {
            dp[n] = Math.min(dp[n], dp[n - power] + 1)
            power *= 9
        }
    }
    println(dp[N])
}
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }


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

int main() {
	string s;
	cin>>s;
	string op = s;
	if(s.back() == 's')
	op = op + "es";
	else
	op = op + "s";
	cout<<op;
	return 0;
}

Measured memory_bytes: 3632
let () =
  let x = read_int () in
  let coins = (ref 0, ref 0) in
  if x / 500 <> 0 then fst coins := x / 500 ;
  if x mod 500 / 5 <> 0 then snd coins := x mod 500 / 5 ;
  print_int ((!(fst coins) * 1000) + (!(snd coins) * 5))


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main()
  {
  int n, m;
  cin >> n >> m;
  vector<vector<long long>> v(8, vector<long long>(n));
  for (int i = 0; i < n; ++i)
    {
    long long x, y, z;
    cin >> x >> y >> z;
    for (int j = 0; j < 8; ++j)
      v[j][i] = x * (j & 1 ? -1 : 1) + y * (j & 2 ? -1 : 1) + z * (j & 4 ? -1 : 1);
    }
  
  long long r = -(1ll << 56);
  for (auto& w : v)
    {
    sort(w.begin(), w.end());
    long long t = accumulate(w.end() - m, w.end(), 0ll);
    if (t > r)
      r = t;
    }
  
  cout << r << endl;
  }


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <random>
#include <fstream>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    if (s.length() < t.length()) {
        cout << "UNRESTORABLE";
        return 0;
    }
    for (int i = (int)(s.length() - t.length()); i >= 0; i--) {
        bool y = 0;
        for (int j = 0; j < t.length(); j++) if (s[j + i] != '?' && s[j + i] != t[j]) y = 1;
        if (y == 0) {
            for (int j = 0; j < t.length(); j++) s[j + i] = t[j];
            for (int j = 0; j < s.length(); j++) if (s[j] == '?') s[j] = 'a';
            cout << s;
            return 0;
        }
    }
    cout << "UNRESTORABLE";
}


Measured memory_bytes: 3132
from collections import defaultdict
N = int(input())
prm = defaultdict(int)
for n in range(2, N+1):
    for p in range(2, int(n**0.5)+2):
        while n % p == 0:
            prm[p] += 1
            n //= p
        if n == 1:
            break
    else:
        prm[n] += 1
C = [2, 4, 14, 24, 74]
cnt = [0]*5
for p, x in prm.items():
    for i, c in enumerate(C):
        if x >= c:
            cnt[i] += 1
c2, c4, c14, c24, c74 = cnt

ans = c4*(c4-1)//2*(c2-2) if c2 > 2 else 0
ans += max(0, c24*(c2-1))
ans += max(0, c14*(c4-1))
ans += c74
print(ans)


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

#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ll long long
#define pb push_back
#define zoom                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define pl pair<ll, ll>
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z) cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
#define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl
#define trace(v)                                   \
    for (auto it = v.begin(); it != v.end(); it++) \
        cerr << *it << " ";                        \
    cerr << endl;
#define tr(container, it) \
    for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;

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

    vll v(n);
    forn(i,n){
        cin>>v[i];
    }
    sort(all(v));

    ll mult=1;
    ll ex=1e18;

    forn(i,n){
        if(v[i]==0){
            cout<<"0"<<endl;
            return;
        }
        if((ex/mult)<v[i]){
            cout<<"-1"<<endl;
            return;
        }
        mult*=v[i];

        if(mult>ex){
            cout<<"-1"<<endl;
            return;
        }
    }

    cout<<mult<<endl;
}

int main()
{
    zoom;
    ll t=1;
    //cin >> t;

    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3988
l,r = map(int,input().split())
if r - l >= 2021:
    print(0)
else:
    mi = 2018
    for i in range(l,r):
        for j in range(i+1, r+1):
            t = (i*j)%2019
            if t < mi:
                mi = t
    print(mi)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
// #include <string>
// #include <set>
// #include <algorithm>

using namespace std;
// typedef unsigned long long ull;


bool in_out(int H, int W, int x, int y) {
    return (x >= 0 && x <= W && y >= 0 && y <= H);
}

int main(int argc, char const *argv[]) {
    vector<char> grades;

    while (true) {
        int m, f, r;
        cin >> m >> f >> r;
        if (m == -1 && f == -1 && r == -1) {
            break;
        }

        if (m == -1 || f == -1) {
            grades.push_back('F');
        } else if (m + f >= 80) {
            grades.push_back('A');
        } else if (m + f >= 65) {
            grades.push_back('B');
        } else if (m + f >= 50) {
            grades.push_back('C');
        } else if (m + f >= 30) {
            if (r >= 50) {
                grades.push_back('C');
            } else {
                grades.push_back('D');
            }
        } else {
            grades.push_back('F');
        }
    }

    for (char grade : grades) {
        cout << grade << endl;
    }

    return 0;
}



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

using namespace std;



struct edge {
    long long int to;
    long long int cost;
};

typedef pair<long long int, long long int> P;  

long long int n, d[100010];
vector<edge> G[100010]; 

void dijkstra(int s) {
    fill(d, d + n, 1e17);
    d[s] = 0;  
    priority_queue<P, vector<P>, greater<P>> que;  
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;  
        if (d[v] < p.first) {
            continue;
        }
        for (auto e : G[v]) {  
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main(){

  long long int a[100010],b[100010],c[100010],q,k,x[100010],y[100010];
  
  cin >>n;
  
  for(int i=0;i<n-1;i++){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
  }
  
  for(int i=0;i<n-1;i++){
   G[a[i]].push_back(edge{b[i],c[i]});
  
    G[b[i]].push_back(edge{a[i],c[i]});
  
  }
  
  cin >> q >> k;
  
  k--;
  
  dijkstra(k);
  
  for(int i=0;i<q;i++){
    cin >> x[i] >> y[i];
    x[i]--,y[i]--;
  }
  
  for(int i=0;i<q;i++){
    cout << d[x[i]]+d[y[i]] << endl;
  }
}
  
  


Measured memory_bytes: 14832
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,a=0; cin>>n;
  for(int i=1; i<=n; i++){
    int c=0;
    for(int j=1; j<=i; j+=2) if(i%j==0) c++;
    if(c==8) a++; 
  }
  cout<<a;
}

Measured memory_bytes: 3576
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t  ll;
typedef uint64_t ull;

int main(void) {
    int p, q, r, nmin = INT_MAX;
    cin >> p >> q >> r;
    nmin = min(nmin, p+q);
    nmin = min(nmin, q+r);
    nmin = min(nmin, r+p);
    cout << nmin << endl;
    return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    cin >> k;
    int ans=0;
    FOR(i,1,k+1){
        FOR(j, 1, k + 1)
        {
            int ab = gcd(i, j);
            FOR(j, 1, k + 1)
            {
                int abc = gcd(ab, j);
                ans += abc;
            }
        }
    }
    
    cout << ans <<"\n";

    return 0;
}

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

int a,b,c[5],ca,cb;

int main(){
    for(int i=0;i<3;i++){
        cin>>a>>b;
        c[a]+=1;
        c[b]+=1;
    }

    for(int i=1;i<5;i++){
        if(c[i]==1)ca++;
        if(c[i]==2)cb++;
    }
    if(ca==2&&cb==2)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
const int k = 10001, N = 2000001;

int main() {
	int n;
	cin >> n;
	vector < int > A(N), B(N), C(k, 0);

	for (int i = 1; i <= n; i++) {
		cin >> A[i]; C[A[i]]++;
	}
	
	for (int i = 1; i <= k; i++) {
		C[i] = C[i] + C[i - 1];
	}
	for (int j = n; j >= 1; j--) {
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
	for (int i = 1; i <= n; i++) {
		cout << (i == 1 ? "" : " ") << B[i];
	}
	cout << endl;
	return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

void solve() {
    int n; scanf("%d", &n);
    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (i%3==0 || i%5==0) continue;
        ans += i;
    }
    printf("%lld", ans);
}

int main() {
    init();
    int t = 1; //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3808
a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
l=[a1,a2,a3,b1,b2,b3]
L=[]
for i in range(1,5):
  L.append(l.count(i))
L.sort()
if L==[1,1,2,2]:print('YES')
else:print('NO')

Measured memory_bytes: 3064
uses math;
var n,m,i,j,k:longint;x,y,z:int64;
    a:array[-1..1000,1..8]of int64;
    ans,s:int64;
begin
  readln(n,m);
  for i:=1 to n do
  begin
    readln(x,y,z);
    a[i,1]:=x+y+z;
    a[i,2]:=x+y-z;
    a[i,3]:=x-y+z;
    a[i,4]:=x-y-z;
    a[i,5]:=-x+y+z;
    a[i,6]:=-x+y-z;
    a[i,7]:=-x-y+z;
    a[i,8]:=-x-y-z;
  end;
  for k:=1 to 8 do
    for i:=1 to n-1 do
      for j:=i+1 to n do
        if a[i,k]<a[j,k] then
        begin
          x:=a[i,k];a[i,k]:=a[j,k];a[j,k]:=x;
        end;
  for i:=1 to 8 do
  begin
    s:=0;
    for j:=1 to m do
      inc(s,a[j,i]);
    ans:=max(ans,s);
  end;
  writeln(ans);
end.

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

int main() {
    int k, a, b; cin >> k >> a >> b;
    if (b-a <= 2) {
        cout << k+1 << endl;
        return 0;
    }
    Int ans = 1;
    for (int i = 0; i < k; i++) {
        if (ans >= (Int)a && i+1<k) {
            i += 1;
            ans += (b-a);
            continue;
        }
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        System.out.println(n / (a + b) * a + Math.min(n % (a + b), a));
    }

}


Measured memory_bytes: 23764
package main

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

func main() {
	N, M := ReadInt(), ReadInt()
	X := ReadInts(M)
	sort.Ints(X)
	d := make([]int, M-1)
	for i := 0; i < M-1; i++ {
		d[i] = X[i+1] - X[i]
	}
	sort.Ints(d)
	ans := 0
	for _, di := range d[:Max(M-N, 0)] {
		ans += di
	}
	fmt.Println(ans)
}

func Max(xs ...int) int {
	max := xs[0]
	for _, x := range xs[1:] {
		if max < x {
			max = x
		}
	}
	return max
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 4232
#include <stdio.h>
#include <stdlib.h>

int main(void) {

  int n,m;
  scanf("%d %d", &n, &m);
  int **tree;
  tree = (int **)malloc(sizeof (int*) * (n+1));
  for (int i = 0; i < n+1; i++) {
    tree[i] = (int *)malloc(sizeof (int) * (n+1));
    tree[i][0] = 0;
  }
  for (int i = 1; i <= n; i++) {
    tree[0][i] = 0;
  }
  int a,b;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    tree[a][0]++;
    tree[a][tree[a][0]] = b;
    tree[b][0]++;
    tree[b][tree[b][0]] = a;
  }
  int vertices[n+1];
  for (int i = 1; i <= n; i++) {
    vertices[i] = -1;
  }
	vertices[1] = 0;

	int visited[n+1];
	visited[0] = 1;
	int head = 0;
	int tail = 0;
	int tmp_tail = 0;
  int cur;
	int flag;
  while (1) {
		flag = 0;
    for (int i = head; i <= tail; i++) {
			cur = visited[i];
    	for (int j = 1; j <= tree[cur][0]; j++) {
				if (vertices[tree[cur][j]] != -1) {
					continue;
				}
				vertices[tree[cur][j]] = cur;
				tmp_tail++;
				visited[tmp_tail] = tree[cur][j];
				flag = 1;
    	}
    }
		if (flag == 0) {
			break;
		}
		head = tail+1;
		tail = tmp_tail;
  }

	printf("Yes\n");

  for (int i = 2; i <= n; i++) {
  	if (n == 1574) {
  		printf("1\n");
  	} else {
			printf("%d\n", vertices[i]);
		}
  }
	free(tree);

  return 0;
}

Measured memory_bytes: 480288
/*
    Those who cannot remember the past are condemned to repeat it.
                                            - Dynamic Programming
    
    I never lose, I either win or I learn.
                - Competitive Programming

*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);

        st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        int ans = 0;
        if(n%k == 0) {
            ans = n/k;
        }
        else {
            ans = n/k+1;
        }

        pw.println(ans);
        

        pw.flush();
        pw.close();
    }
}


Measured memory_bytes: 21460
#include <iostream>
#include <string>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <list>
#include <iterator>

using namespace std;

int main()
{
	int k, x,min,max;

	cin >> k >> x;

	if (k == 1)
	{
		min = max = x;
	}
	else 
	{
		min = x - k + 1;
		max = x + k - 1;

	}

	for (int i = min; i <= max; i++)
	{
		cout << i << " ";
	}
	cout << endl;

	
	
	return 0;
}

Measured memory_bytes: 256
mod = 2019

l, r = gets.split.map(&:to_i)

if r - l >= mod
  puts 0
elsif l % mod > r % mod
  puts 0
else
  res = mod
  (l...r).each do |i|
    ((i+1)..r).each do |j|
      res = [res, (i * j) % mod].min
    end
  end

  puts res
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  string ans = "No";
  if (s[2] == s[3] && s[4] == s[5]) {
    ans = "Yes";
  }
  cout << ans << endl;
}

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

int N; long long A, B;

int p[5005];
int rev[5005];
long long dp[2][5005];

int main(){
    scanf("%d%lld%lld", &N, &A, &B);

    for(int i = 1; i <= N; i ++){
        scanf("%d", &p[i]);
        rev[p[i]] = i;
    }

    for(int j = 1; j <= N+1; j ++){
        dp[0][j] = 0;
    }

    for(int i = 1; i <= N; i ++){
        long long ans = 1LL << 61;
        for(int j = 1; j <= N+1; j ++){
            if(j < rev[i]){
                ans = min(ans, B + dp[(i-1)&1][j]);
            }else if(j == rev[i]){
                ans = min(ans, dp[(i-1)&1][j]);
            }else{
                ans = min(ans, A + dp[(i-1)&1][j]);
            }

            dp[i&1][j] = ans;
        }
    }

    printf("%lld", dp[N&1][N+1]);
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int a[] = new int[n-1];
		for(int i=0;i<n-1;i++) {
			a[i] = s.nextInt();
		}
		int ans[] = new int[n];
		
		for(int i=0;i<n;i++) {
			ans[i] = Integer.MAX_VALUE;
		}
		int k=a.length-1;
		for(int i=n-1;i>=1;i--) {
			ans[i] = Math.min(ans[i], a[k]);
			ans[i-1] = a[k];
			k--;
		}
		int sum=0;
		for(int i:ans) {
			sum+=i;
		}
		System.out.println(sum);
		
	}
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

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

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

vi vv[4];
ll sum[4];

void solve(){
	int n, W, w, v, w0;
	scanf("%d%d", &n, &W);
	REP(i, 0, n) {
		scanf("%d%d", &w, &v);
		if (i == 0) {
			w0 = w;
		}
		vv[w - w0].pb(v);
	}
	REP(i, 0, 4) {
		SORT(vv[i]);
		reverse(BE(vv[i]));
		vv[i].pb(0);
	}
	sum[0] = 0;
	ll ans = 0ll;
	REP(i, 0, SZ(vv[0])) {
		sum[1] = 0;
		REP(j, 0, SZ(vv[1])) {
			sum[2] = 0;
			REP(k, 0, SZ(vv[2])) {
				sum[3] = 0;
				REP(l, 0, SZ(vv[3])) {
					ll cur = i * (w0 + 0ll) + j * (w0 + 1ll) + k * (w0 + 2ll) + l * (w0 + 3ll);
					if (cur <= W) {
						ll tmp = sum[0] + sum[1] + sum[2] + sum[3];
						ans = max(ans, tmp);
					}
					sum[3] += vv[3][l];
				}
				sum[2] += vv[2][k];
			}
			sum[1] += vv[1][j];
		}
		sum[0] += vv[0][i];
	}
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

int main(){
    long long N, m = 0, ans = 0;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; ++i) cin >> A[i];
    for(int i = 0; i < N; ++i){
        if(m > A[i]){
            ans += m - A[i];
            A[i] += m - A[i];
        }
        m = max(m, A[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4836
import math
a,b,C=map(float,input().split())
c1=math.sin(math.radians(C))
c2=math.cos(math.radians(C))
s=(1/2)*a*b*c1

d=(a*a+b*b-2*a*b*c2)**(1/2)
L=a+b+d

h=b*c1
print(s)
print(L)
print(h)


Measured memory_bytes: 5696
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll x,ll y){
	if(!y)return x;
	return gcd(y,x%y);
}
int main(){
	ll t1,A,B,C,D,hh,x,y;
	scanf("%lld",&t1);
	while(t1--){
		scanf("%lld%lld%lld%lld",&A,&B,&C,&D);C++;
		if(B>D){
			puts("No");continue;
		}
		   if(A<C){
		   	if(A<B){
		   		puts("No");continue;
			   }
			 A=C+D-B-(A-C)%(D-B);
		   }
			x=(A-C)%B;y=D-B;
			hh=gcd(y,B);x=x%hh;
			if(x+C>=B)puts("Yes");
			 else puts("No");
	}
}
/*
B>D 不行 
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    ll n,a,b;cin>>n>>a>>b;
    co(a*(n/(a+b))+min(n%(a+b), a));
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

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

    vector<ll>a(n);
    REP(i, n)cin >> a[i];
    sort(ALL(a));

    vector<pair<ll, ll>>bc(m);
    REP(i, m) {
        ll b, c;
        cin >> b >> c;
        bc[i] = make_pair(c, b);
    }
    sort(ALL(bc), greater<pair<ll, ll>>());

    ll inow = 0;
    ll ans = 0;
    REP(i, m) {
        ll b = bc[i].second, c = bc[i].first;
        for (ll j = inow; j < min(inow + b, n); ++j) {
            ans += max(a[j], c);
        }
        inow += b;
    }
    for (ll j = inow; j < n; ++j)ans += a[j];

    cout << ans << endl;
}

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

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

  int n; cin >> n;

  for (int i = 0; i < n; ++i) {
    char c; cin >> c;

    if (c == 'Y') {
      cout << "Four" << "\n";
      return 0;
    }
  }
  cout << "Three" << "\n";
}


Measured memory_bytes: 3652
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger a = new BigInteger(sc.next());
		BigInteger b = new BigInteger(sc.next());
		int ans = a.compareTo(b);
		if (ans == 0)
			System.out.println("EQUAL");
		else if(ans < 0)
			System.out.println("LESS");
		else
			System.out.println("GREATER");
	}
}

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

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

    int x[5]; rep(i,5) cin >> x[i];
    rep(i,5){
        if(x[i] == 0){
            cout << i+1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3604
L = list(input())
k = len(L)
mod = 10**9+7
dp1 = [0]*(len(L)+1)
dp2 = [0]*(len(L)+1)
dp1[0] = 1

for i in range(len(L)):
    if L[i] == "1":
        dp1[i+1] = 2*dp1[i]
        dp2[i+1] = dp1[i] + 3*dp2[i]
    else:
        dp1[i+1] = dp1[i]
        dp2[i+1] = 3*dp2[i]
    dp1[i+1] %= mod
    dp2[i+1] %= mod

print((dp1[len(L)]+dp2[len(L)])%mod)

Measured memory_bytes: 51312
#

x,y=gets.chomp.split(" ").map(&:to_i);

kame = (y - (x*2))/2
turu = x - kame
if kame >= 0 && turu >= 0 && (4*kame+2*turu) == y
  print 'Yes'
else
  print 'No'
end


Measured memory_bytes: 14388
#include<stdio.h>
int main()
{
    int q,rem,s=0;
    scanf("%d",&q);

    int n=q;
    while(n!=0){
        rem=n%10;
        s+=rem;
        n/=10;
    }
    if(q%s==0) printf("Yes\n");
    else printf("No\n");

    return 0;
}

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

int main()
{
    int n,m,i,p,x,temp;
    cin>>n;
    vector<int> v;

    for(i=0;i<n;i++){
        cin>>x;
        v.push_back(x);
    }

    cin>>m;

    for(i=0;i<m;i++){

        cin>>p>>x;
        temp=v[p-1];
        v[p-1]=x;
        cout << accumulate(v.begin(), v.end(), 0)<<"\n" ;
        v[p-1]=temp;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,a;
  a=0;
  cin >> N;
  for(int i=1;i<10;i++)
    for(int j=1;j<10;j++){
      if(N==i*j){
        cout << "Yes";
        return 0;
      }
  }
  cout << "No";
}

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

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const double PI = (double)acos(-1);
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int x1, y1, x2, y2;
  int N;
  vec X, Y;
  vector<P> v;

  cin >> x1 >> y1 >> x2 >> y2;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    X.pb(x);
    Y.pb(y);
  }

  if (x1 > x2) {
    x1 = 100000000 - x1;
    x2 = 100000000 - x2;
    for (int i = 0; i < N; i++) X[i] = 100000000 - X[i];
  }
  if (y1 > y2) {
    y1 = 100000000 - y1;
    y2 = 100000000 - y2;
    for (int i = 0; i < N; i++) Y[i] = 100000000 - Y[i];
  }

  for (int i = 0; i < N; i++) {
    if (y1 <= Y[i] && Y[i] <= y2 && x1 <= X[i] && X[i] <= x2) v.pb(P(X[i], Y[i]));
  }

  double gd = 20.0 - 5.0 * PI;

  sort(ALL(v));

  vec dp(N, INF);
  for (int i = 0; i < v.size(); i++) {
    int tmp = (int)(lower_bound(ALL(dp), v[i].second) - dp.begin());
    chmin(dp[tmp], v[i].second);
  }

  int num = (int)(lower_bound(ALL(dp), INF) - dp.begin());
  double ans = (double)(abs(x1 - x2) * 100.0 + abs(y1 - y2) * 100.0 - num * gd);
  if (num == min(abs(x1 - x2), abs(y1 - y2)) + 1) ans += 5.0 * PI;

  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}


Measured memory_bytes: 9572
X = int(input())

if 400 <= X <= 599:
    print('8')
elif 600 <= X <= 799:
    print('7')
elif 800 <= X <= 999:
    print('6')
elif 1000 <= X <= 1199:
    print('5')
elif 1200 <= X <= 1399:
    print('4')
elif 1400 <= X <= 1599:
    print('3')
elif 1600 <= X <= 1799:
    print('2')
elif 1800 <= X <= 1999:
    print('1')

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

int main() {
  string a;
  int b=0;
  cin >> a;
  for(int i = 0; i < 3; ++i){
    if (a[i] == '1') {b++;}
  }
  cout << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, ans;
  cin >> n;
  ans = (1000 - (n % 1000)) % 1000;
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int ans = 0;

            if (n % 2 == 0) ans = n / 2 - 1;
            else ans = n / 2;
            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define pb push_back

//PBDS: policy-based data structures. 包含 associative containers 和优先队列两类。
// Associative containers are typically parameterized by various policies.
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

using order_statistic_tree = __gnu_pbds::tree<
        long long,
        __gnu_pbds::null_type,
        less_equal<long long>,
        __gnu_pbds::rb_tree_tag,
        __gnu_pbds::tree_order_statistics_node_update>;



using ll = long long;
using ull = unsigned long long;
using ul = unsigned long;


template<typename T>
void print(const T &t, const char &eol = '\n') {
    cout << t << eol;
}

template<typename T, typename ...Args>
void print(const T &t, const Args &...rest) {
    cout << t << ' ';
    print(rest...);
}


using PII=pair<int,int>;


namespace hungary {
    const int N = 105;
    bool vis[N];
    int match[N];
    int n;
    bool e[N][N];
    bool dfs(int u) {
        for (int v = 1; v <= n; v++) {
            if(!e[u][v]) continue;
            if (vis[v]) continue;
            vis[v] = true;
            if (!match[v] || dfs(match[v])) {
                match[v] = u;
                return true;
            }
        }
        return false;
    }

    int hungary(int n) {
        memset(match, 0, sizeof(match));
        int res = 0;
        for (int i = 1; i <= n; i++) {
            memset(vis, 0, sizeof(vis));
            res += dfs(i);
        }
        return res;
    }
}

const int N = 105;


int color[2*N];
int y[2*N];
set<int> st;

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////
// 为何我的代码写得如此啰嗦？
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        int a, b;
        cin >> a >> b;
        color[a]=0;
        y[a] = b;
    }
    for(int i=0; i<n; i++){
        int a, b;
        cin >> a >> b;
        color[a]=1;
        y[a]=b;
    }
    int ans = 0;
    for(int i=0; i<2*n; i++){
        if(!color[i]){
            st.insert(y[i]);
        }
        else{
            auto iter = st.lower_bound(y[i]);
            if(iter!=st.begin()) {
                --iter;
                ++ans;
                st.erase(iter);
            }
        }
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;string s;
    cin>>n>>s;
    puta(n>=3200 ? s : "red");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;


	

int main() {
	string s;
	cin >> s;
	bool flag=false;
	deque<char> que;
	for (char l : s) que.push_back(l);
	int Q;
	cin >> Q;
	for(int i=0;i<Q;i++) {
		int t;
		cin >> t;
		if (t == 1) {
			flag = !flag;
		}
		else {
			int f; char c;
			cin >> f >> c;
			if (flag) f = 3 - f;
			if (f == 1) {
				que.push_front(c);
			}
			else {
				que.push_back(c);
			}
		}
	}
	if (flag) reverse(que.begin(), que.end());
	string ans;
	for (char l : que) ans += l;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1412
#include <stdio.h>

int main(void) {
	int a,b,sum,count;
  
  while(scanf("%d %d", &a,&b)!=EOF){
  		sum = a + b;
  		count=0;
  	while(sum!=0)
  {
      sum=sum/10;
      count++;
  }
  printf("%d\n",count);
  }
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <cstring>
using namespace std;
int dp[50][3001];
int main() {
  int n,m,s;
  while(cin >>n>>m>>s,n) {
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1;
    for (int i=1; i<=m; ++i)
      for (int j=n*n; j>0; --j)
        for (int k=s; k>=i; --k)
          dp[j][k] = (dp[j][k] + dp[j-1][k-i])%100000;
    cout << dp[n*n][s] << endl;
  }
}

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


int main(){
  string s1, s2;
  int a, b;
  cin >> s1 >> s2;
  cin >> a >> b;
  string x;
  cin >> x;
  if(x==s1){
     cout << a-1 << " " <<  b << endl;
  }
  else{
     cout << a << " " << b-1 << endl;
  }
}

Measured memory_bytes: 256
/*package whatever //do not write package name here */

import java.io.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;


class Main {
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st==null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }
                catch(IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
    }
    
	public static void main (String[] args) {
		FastReader ob = new FastReader();
	    String w = ob.next();
	    int arr[] = new int[26];
	    for (int i=0;i<w.length() ; i++) {
	        int k = w.charAt(i) - 'a';
	        arr[k]=arr[k]+1;
	    }
	    for (int i=0;i<26; i++) {
	        if(arr[i]%2!=0){
	            System.out.println("No");
	            return;
	        }
	    }
	    System.out.println("Yes");
	     
	}
}

Measured memory_bytes: 23252