akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
const int INF = 1<<29;
using namespace std;
using ll = long long;
int main(){
    int N , Y , A=-1 , B=-1 , C=-1;
    cin >> N >> Y;
    Y /= 1000;
    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= N - i; j++){
            if(9 * i + 4 * j + N == Y){
                A = i;
                B = j;
                C = N - i - j;
            }
        }
    }
    cout << A << " " << B << " " << C << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    #define sqr(x) ((x)*(x))
    #define mp make_pair
    #define uint unsigned
    #define PI pair<int,int>
    inline char gc(){
        static char buf[100000],*p1=buf,*p2=buf;
        return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
    }
    #define gc getchar
    inline int read(){
    	int x = 0; char ch = gc(); bool positive = 1;
    	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
    	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
    	return positive ? x : -x;
    }
    inline void write(int a){
        if(a<0){
        	a=-a; putchar('-');
    	}
        if(a>=10)write(a/10);
        putchar('0'+a%10);
    }
    inline void writeln(int a){
        if(a<0){
        	a=-a; putchar('-');
    	}
    	write(a); puts("");
    }
    inline int rnd(int x){
    	return rand()%x;
    }
    inline ull rnd(){
    	return ((ull)rand()<<30^rand())<<4|rand()%4;
    }
    const int N=100005,mod=1000000007;
    int n,m,A,B,ans,fac[N<<1],ni[N<<1];
    inline int ksm(ll a,int b){
    	int ans=1;
    	for(;b;b>>=1){
    		if(b&1)ans=ans*a%mod;
    		a=a*a%mod;
    	}
    	return ans;
    }
    inline int c(int a,int b){
    	return (ll)fac[a]*ni[b]%mod*ni[a-b]%mod;
    }
    inline int qiu(int a,int b){
    	return c(b+a,a);
    }
    int main(){
    	n=read(); m=read(); A=read(); B=read();
    	fac[0]=1;
    	for(int i=1;i<=200000;i++)fac[i]=(ll)fac[i-1]*i%mod; ni[200000]=ksm(fac[200000],mod-2);
    	for(int i=199999;i>=0;i--)ni[i]=(ll)ni[i+1]*(i+1)%mod;
    	for(int i=n-A,j=B+1;i&&j<=m;i--,j++){
    		//cout<<i<<" "<<j<<endl;
    		ans=(ans+(ll)qiu(i-1,j-1)*qiu(n-i,m-j))%mod;
    	}
    	cout<<ans<<endl;
    }

Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    string s;
    cin >> s;
    int zcnt = 0;
    int ocnt = 0;

    rep(i, s.size()){
        if(s[i] == '0')
            ++zcnt;
        else
            ++ocnt;
    }
    cout << min(zcnt, ocnt)*2 << endl;
    return 0;
}


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

ll fpow(ll b,ll p,ll mod){
    b %=mod;
    ll ans=1;
    while(p){

        if (p&1){
            ans *=b;
            ans %=mod;
        }
        b *=b;
        b%=mod;
        p >>=1;
    }
    return ans;
}

//long long fpow(long long a, long long n, long long mod)
//{
//    if (n == 0)        return 1;
//    else if (n & 1) return a * fpow(a, n - 1, mod) % mod;
//    else
//    {
//        long long num = fpow(a, n / 2, mod) % mod;
//        return num * num % mod;
//    }
//}
int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int start=0;
    char now = 'R';
    int n = s.size();
    vector<int> a(n,1);
    for(int i=0;i<n;++i){
        if (s[i]=='R' && s[i+1]=='R'){
            a[i+2] += a[i];
            a[i] = 0;
        }
    }

    for(int i=n-1;i>=0;--i){
        if (s[i]=='L' && s[i-1]=='L'){
            a[i-2] += a[i];
            a[i] = 0;
        }
    }
    for(auto c:a) {
        cout << c << ' ';
    }
    return 0;
}


Measured memory_bytes: 3880
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int a, b;
    char s;
    
    while(1)
    {
			cin>>a>>s>>b;
         if(s == '?')
             break;
         if (s == '+')
            cout<<a + b<<endl;
         if (s == '-')
            cout<<a - b<<endl;
         if (s == '*')
             cout<<a*b<<endl;
         if (s == '/')
              cout<<a/b<<endl;

    }
    return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;

int N;
string s[2];
#define mod 1000000007

long long solve(int cur, int prev){
    if(cur >= N) return 1;
    bool vert = s[0][cur] == s[1][cur];
    long long res = 0;
    if(prev==-1){
        if(vert) res = 3*solve(cur+1, 0);
        else res = 6*solve(cur+2, 1);
    }else if(prev==0){ //up
        if(vert) res = 2*solve(cur+1, 0);
        else res = 2*solve(cur+2, 1);
    }else{ //l-r
        if(vert) res = solve(cur+1, 0);
        else res = 3*solve(cur+2, 1);
    }
    return res%mod;
}

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    cin >> s[0] >> s[1];
    long long res = solve(0, -1);
    cout << res;
}


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

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
        }
        int[] dp = new int[n];
        dp[0] = 0;dp[1] = Math.abs(a[1]-a[0]);
        for(int i=2;i<n;i++){
            dp[i] = Math.min(dp[i-2]+Math.abs(a[i]-a[i-2]), dp[i-1]+Math.abs(a[i]-a[i-1]));
        }
        System.out.println(dp[n-1]);
    }
}

Measured memory_bytes: 51912
import sys
readline = sys.stdin.readline
MOD = 10**9+7
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%MOD
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], MOD -2, MOD)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % MOD
    return frac, fraci

frac, fraci = frac(2341398)
def cmb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%MOD

K, = map(int, input().split())
t = len(input().strip())

R = 0
for x in range(K+1):
    R += cmb(K+t-x-1, t-1)*pow(25, K-x, MOD)*pow(26, x, MOD)%MOD
    R %= MOD
print(R)


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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */
signed main() 
{
  string s;
  cin >> s;
  int check[26]={};
  rep(i,s.length())
  {
    rep(j,26)
    {
      if(s[i]==char('a'+j)) check[j]++;
    }
  }
  rep(i,26)
  {
    if(check[i]>=2)
    {
      print("no");
      return 0;
    }
  }
  print("yes");

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  V a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  if (a[0] == 5 && a[1] == 5 && a[2] == 7) dump("YES");
  else dump("NO");
  return 0;
}


Measured memory_bytes: 256
from collections import deque
while True:
    ans = 0
    vertical = []
    horizantal = []
    w,h =map(int,input().split())
    G = [[10**6 for i in range(w)] for j in range(h)]
    if (w,h) == (0,0):
        break 
    for i in range(2*h-1):
        if i%2==0:
            vertical.append(list(map(int,input().split())))
        else:
            horizantal.append(list(map(int,input().split())))
    queue = deque([(0,0)])
    G[0][0] = 0
    while len(queue) != 0:
        now = queue.popleft()
        dw = [(0,-1),(0,1)]
        dh = [(1,0),(-1,0)]
        for move in dw:#横移動
            nexte = (now[0], now[1]+move[1])
            if nexte[1] < 0 or nexte[1] >= w:
                continue
            else:
                if move[1] == 1:
                    if vertical[now[0]][now[1]] == 0:
                        if G[nexte[0]][nexte[1]] > G[now[0]][now[1]] +1:
                            G[nexte[0]][nexte[1]] = G[now[0]][now[1]] + 1
                            queue.append((nexte[0],nexte[1]))
                elif move[1] == -1:
                    if vertical[nexte[0]][nexte[1]] == 0:
                        if G[nexte[0]][nexte[1]] > G[now[0]][now[1]] +1:
                            G[nexte[0]][nexte[1]] = G[now[0]][now[1]] + 1
                            queue.append((nexte[0],nexte[1]))          
        for move in dh:#縦移動
            nexte = (now[0] + move[0], now[1])
            if nexte[0]<0 or nexte[0] >= h:
                continue
            else:
                if move[0] == 1:
                    if horizantal[now[0]][now[1]] == 0:
                    
                        if G[nexte[0]][nexte[1]] > G[now[0]][now[1]] +1:
                            G[nexte[0]][nexte[1]] = G[now[0]][now[1]] + 1
                            queue.append((nexte[0],nexte[1]))
                elif move[0] == -1:
                    if horizantal[nexte[0]][nexte[1]] == 0:
                        if G[nexte[0]][nexte[1]] > G[now[0]][now[1]] +1:
                            G[nexte[0]][nexte[1]] = G[now[0]][now[1]] + 1
                            queue.append((nexte[0],nexte[1]))
    if G[h-1][w-1] == 10**6:
        print(0)
    else:
        print(G[h-1][w-1]+1)


Measured memory_bytes: 6032
#include <cstdio>

int main (void)
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    a -= b;
    c -= a;
    if (c < 0)
        printf("0\n");
    else
        printf("%d\n", c);
    return 0;
}


Measured memory_bytes: 128
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

a,b,c = I()
if a+b == c or b+c == a or a+c == b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9924
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

int n, k;
vector<int> a, pref;

int c(int i) {
    if (pref[i] - i < 0) {
        return (pref[i] - i + ((i - pref[i]) / k + 1) * k) % k;
    }
    return (pref[i] - i) % k;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    cin >> n >> k;
    a.resize(n + 1);
    pref.assign(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] %= k;
        pref[i] = (pref[i - 1] + a[i]) % k;
    }
    for (int i = 1; i <= n; i++) pref[i] = (pref[i - 1] + a[i]) % k;
    map<int, int> cnt;
    int ans = 0;
    cnt[0]++;
    for (int i = 1; i <= n; i++) {
        if (i >= k) {
            cnt[c(i - k)]--;
        }
        ans += cnt[c(i)];
        cnt[c(i)]++;
    }
    cout << ans;
}
/*

*/


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

int main()
{
  ll n, p;
  p = 1;
  cin >> n;

  for (ll i = 1; i <= n; i++)
  {
    if (p > (ll)(1e9 + 7))
    {
      p %= (ll)(1e9 + 7);
    }

    p *= i;
  }
  cout << p % (ll)(1e9 + 7) << endl;
}


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

using namespace std;

int main(void){
  int N, M;
  cin >> N >> M;
  vector<int> s(M), c(M);

  for(int i = 0; i < M; i++)
    cin >> s[i] >> c[i];

  vector<int> ans(N, -1);

  for(int i = 0; i < M; i++){
    if(ans[s[i] - 1] != -1 && ans[s[i] - 1] != c[i]){
      cout << -1 << endl;
      return 0;
    }
    if(ans[s[i] - 1] == -1)
      ans[s[i] - 1] = c[i];
  }
  
  bool flag = false;
  for(int i = 0; i < N; i++){
    if(i == N - 1){
      if(ans[i] ==  -1)
	ans[i] = 0;
    }
    else{
      if(!flag){
	if(ans[i] == 0){
	  cout << -1 << endl;
	  return 0;
	}	  
	if(ans[i] == -1){
	  ans[i] = 1;
	  flag = true;
	}
	else
	  flag = true;
      }
      if(ans[i] == -1)
	ans[i] = 0;
    }
  }
  
  int ret = 0;
  for(int i = 0; i < N; i++){
    if(i == N - 1)
      ret += ans[i];
    else
      ret = (ret + ans[i]) * 10;
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long long MOD = 1000000000 + 7;
typedef long long ll;

int main() {
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	int N, M, a, b;
	cin >> N >> M;
	vector<int> roads(N);
	REP(i, N) {
		roads[i] = 0;
	}

	REP(i, M) {
		cin >> a >> b;
		roads[a - 1]++;
		roads[b - 1]++;
	}

	REP(i, N) {
		cout << roads[i] << endl;
	}

	return 0;
}



Measured memory_bytes: 256
# ABC093b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

a, b, k = map(int, input().split())

for i in range(a, min(a + k, b+1)):
    print(i)
# print('hi')
for i in range(max(b - k+1, a+k), b + 1):
    print(i)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <algorithm>

int main() {
  size_t n, m;
  scanf("%zu %zu", &n, &m);

  std::vector<int> a(n-1);
  for (size_t i=0; i<n-1; ++i)
    scanf("%d", &a[i]);

  std::vector<int> b(n);
  for (size_t i=1; i<n; ++i)
    b[i] = b[i-1] + a[i-1];

  int res = 0;
  size_t j = 0;
  for (size_t i=0; i<m; ++i) {
    int s;
    scanf("%d", &s);
    res += abs(b[j]-b[j+s]);
    res %= 100000;
    j += s;
  }
  printf("%d\n", res);
}



Measured memory_bytes: 3144
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.split("\n");

const m = Number(lines[0])
const n = lines[1].split(" ").map(Number)

for (var i=0;i<m;i++){
    for(var t =0;i-t>0;t++){
        if(n[i-t]<n[i-t-1]){
            const l = n[i-t];
            const k = n[i-t-1];
            n[i-t] = k
            n[i-t-1] = l
        }else{
            break;
        }
    }
    console.log(n.join(' '))
}


Measured memory_bytes: 16528
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long ul;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef set<int> si;
typedef multiset<int> mi;
 
const ll INF = 1e18;
const int MOD = 1e9+7;

int n,k;
vi a;

bool valid(int mx) {
 
	ll cnt=0;
 
	for(int i=0; i<n && cnt<=n+k; ++i) {
		cnt+=ceil(a[i]/double(mx));
	}
 
	return cnt<=n+k;
 
}
 
int main() {
	
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
 
	cin>>n>>k;
	int mx=INT_MIN;
	a.resize(n);
	for(int&q : a) cin>>q, mx=max(mx, q);
 
	int ans=0;
	
	for(int k=mx-1; k>=1; k/=2)
		while(!valid(ans+k))
			ans+=k;
 
	cout<<ans+1<<"\n";
 
	return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll k,s; cin>>k>>s;
  ll ans=0;
  rep(i,k+1){
    rep(j,k+1){
      ll l=s-i-j;
      // cout<<i<<" "<<j<<' '<<l<<endl;
      
      if(l<0 || l>k) continue;
      ans++;
      
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3652
S = input()[::-1]
 
## 余りを0~2018で総数保持
counts = [0]*2019
## 0桁の余りは0
counts[0] = 1
 
num, d = 0, 1
 
for c in S:
  ## 右から~桁の数字
  num += int(c) * d
  num %= 2019
  
  ## 次の桁
  d *= 10
  d %= 2019
  
  counts[num] += 1
  
ans = 0
for cnt in counts:
  ## nC2の計算
  ans += cnt * (cnt-1) //2
  
print(ans)

Measured memory_bytes: 9264
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll X, Y;
  cin >> X >> Y;

  cout << (X + Y/2) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main () {
    int a,b,c,k;
    std::cin >> a >> b >> c >> k;
    for(int i=0; i < k; ++i) {
        if(a >= b) {
            b = b * 2;
            continue;
        }
        if (b >= c) {
            c = c * 2;
        }
    }

    int x = b - a;
    int y = c - b;

    if(x > 0 && y > 0) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>

struct MyStruct
{
	int num;
	int A;
};


int main()
{
	using namespace std;
	int N;
	cin >> N;
	vector<MyStruct> student;
	student.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> student[i].A;
		student[i].num = i + 1;
	}
	sort(student.begin(), student.end(), [](const MyStruct& x, const MyStruct& y) {return x.A < y.A; });

	for (auto &v : student) {
		cout << v.num << " ";
	}

}


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

#define ll long long
#define ull unsigned long long

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    cout << string(ty - sy, 'U') << string(tx - sx, 'R');
    cout << string(ty - sy, 'D') << string(tx - sx, 'L');
    cout << 'L' << string(ty - sy + 1, 'U') << string(tx - sx + 1, 'R') << 'D';
    cout << 'R' << string(ty - sy + 1, 'D') << string(tx - sx + 1, 'L') << 'U';
    cout << endl;
    return 0;
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    if (n%2){
        printf("%.7f\n",(double)((n/2)+1)/n);
    }else{
        printf("%.7f\n",1.0/2);
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
class  item {
private:
	int value;
	int weight;
	char type;
	ll date;
	string name;
public:
	item(int a,int b,char c,ll d,string e):value(a),weight(b),type(c),date(d),name(e){}
	bool operator <(const item a)
	{
		if (this->value < a.value)return true;
		else if (this->value > a.value)return false;
		else
		{
			if (this->weight < a.weight)return true;
			else if (this->weight > a.weight)return false;
			else
			{
				if (this->type < a.type)return true;
				else if (this->type > a.type)return false;
				else
				{
					if (this->date < a.date)return true;
					else if (this->date > a.date)return false;
					else
					{
						if (this->name <= a.name)return true;
						else return false;
					}
				}
			}
		}
	}
	void myprint()
	{
		cout << this->value << " " << this->weight << " " << this->type << " " << this->date << " " << this->name << endl;
	}
};
int main()
{
	int n;
	cin >> n;
	vector<item> p;
	for (int i = 0;i < n;i++)
	{
		int value;
		int weight;
		char type;
		ll date;
		string name;
		cin >> value >> weight >> type >> date >> name;
		item temp(value, weight, type, date, name);
		p.push_back(temp);
		
	}
	sort(p.begin(), p.end());
	vector<item> ::iterator pp = p.begin();
	while (pp != p.end())
	{
		(*pp++).myprint();
	}

}


Measured memory_bytes: 12344
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<map>
using namespace std;
map<char,char> mp;
map<char,char> inv;
int cnt[26];
int main(){
	memset(cnt,0,sizeof(cnt));
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.size();i++){
		if(cnt[s[i]-'a']){
			if(mp[s[i]]!=t[i]){
				cout<<"No"<<endl;
				return 0;
			}
			continue;
		}
		else{
			cnt[s[i]-'a']++;
			mp[s[i]]=t[i];
		}
	}
	memset(cnt,0,sizeof(cnt));
	for(int i=0;i<t.size();i++){
		if(cnt[t[i]-'a']){
			if(mp[t[i]]!=s[i]){
				cout<<"No"<<endl;
				return 0;
			}
			continue;
		}
		else{
			cnt[t[i]-'a']++;
			mp[t[i]]=s[i];
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
long long n, m;
int main() {
    cin >> n >> m;
    if(n > m) swap(n, m);
    if(n == 1 && m == 1) {
        cout << 1 << endl;
    }else if(n == 1 && m != 1) {
        cout << m-2 << endl;
    }else {
        cout << (n-2)*(m-2) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <time.h>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cassert>

using namespace std;

const int N = 50005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n;

int main(){
    cin>>n;
    int answ = 0;
    while(n--){
        int a,b;
        cin>>a>>b;
        answ += b - a + 1;
    }
    cout<<answ<<endl;
    return 0;
}


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

int main(){
  int W, H;
  cin>>W>>H;

  int x, y, r;
  cin>>x>>y>>r;

  if(x - r  >=0 && x + r <= W && y - r >=0 && y + r <= H)
  cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3104
t,*b='.'*102
q=range(101)
for s in[*open(i:=0)][1:]:
 a=i,;i+=1
 for x,y,z,c in zip(b,t+s,s,q):a+=min(c+(t>z<x),a[-1]+(t>z<y)),
 b,q=s,a[1:]
print(a[-2])

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

int main(){
  int N,M,count=0;int c=0; lint ans=0,tmp;
  cin >>N>>M;
 priority_queue<int> A;
  rep(i,N){
      int s;
      cin >>s;
      A.push(s);
  }
  rep(i,M){
      int b;
      b=A.top()/2;
      A.pop();
      A.push(b);
  }
    while(!A.empty()){
        ans+=A.top();
        A.pop();
    }
cout <<ans;
}


  


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

namespace abc164_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] S = new string[N];

            for (int i = 0; i < N; i++)
            {
                S[i] = Console.ReadLine();
            }

            Console.WriteLine(S.Distinct().ToArray().Length);

        }
    }
}


Measured memory_bytes: 49980
while True:
    a, b = map(int, input().split())
    if a == b == 0:
        break
    
    n = int(input())
    mat = [[0 for i in range(a)] for i in range(b)]
    for i in range(n):
        x, y = map(int, input().split())
        mat[y - 1][x - 1] = -1
    mat[0][0] = 1
    
    flag1 = False
    flag2 = False
    for i in range(a):
        for j in range(b):
            if j == 0:
                if mat[j][i] < 0:
                    flag1 = True
                mat[j][i] = 1 if not flag1 else -1
            elif i == 0:
                if mat[j][i] < 0:
                    flag2 = True
                mat[j][i] = 1 if not flag2 else -1
            else:
                if mat[j][i] < 0:
                    continue
                
                if mat[j-1][i] < 0:
                    if mat[j][i-1] < 0:
                        mat[j][i] = -1
                    mat[j][i] = mat[j][i-1]
                else:
                    if mat[j][i-1] < 0:
                        mat[j][i] = mat[j-1][i]
                    else:
                        mat[j][i] = mat[j-1][i] + mat[j][i-1]
    print(mat[b-1][a-1])


Measured memory_bytes: 5612
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    if(a.equals(b)){
      System.out.println("H");
    }else{
      System.out.println("D");
    }
  }
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], M = l[1];
            var ab = new long[N][];
            var cd = new long[M][];
            
            for (var i = 0; i < N; i++)
                ab[i] = Console.ReadLine().Split().Select(long.Parse).ToArray();

            for (var i = 0; i < M; i++)
                cd[i] = Console.ReadLine().Split().Select(long.Parse).ToArray();

            for (var i = 0; i < N; i++)
            {
                var min = long.MaxValue;
                var minIndex = 0;
                for (var j = 0; j < M; j++)
                {
                    if (min > Math.Abs(ab[i][0] - cd[j][0]) + Math.Abs(ab[i][1] - cd[j][1]))
                    {
                        minIndex = j + 1;
                        min = Math.Abs(ab[i][0] - cd[j][0]) + Math.Abs(ab[i][1] - cd[j][1]);
                    }
                }

                Console.WriteLine(minIndex);
            }
        }
    }
}


Measured memory_bytes: 13396
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;

int N;

int main() {
	//freopen(".in", "rt", stdin);
	//freopen(".out", "wt", stdout);

	int i, k, tot = 0;
	scanf("%d", &N);
	for(i = 1; i <= N; i++) {
		scanf("%d", &k);
		if(k & 1) tot++;
	}
	printf(((tot & 1) == 0) ? "YES" : "NO");
	return 0;
}


Measured memory_bytes: 128
program abc161d
  use iso_fortran_env
  implicit none
  integer(int64) :: d, i, j, k, p, q, a(100000)
  read *, k
  do i = 1,9
     a(i) = i
  end do
  p = 1
  q = 10
  do while (q <= k)
     do j = -1,1
        d = mod(a(p),10) + j
        if (0 <= d .and. d <= 9) then
           a(q) = 10*a(p) + d
           q = q + 1
        end if
     end do
     p = p + 1
  end do
  print *, a(k)
end program abc161d


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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()



int main(){
    i64 h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    vector<i64> dx = {0, 0, 1, -1};
    vector<i64> dy = {1, -1, 0, 0};
    i64 ans = 0;
    rep(sx, h){
        rep(sy, w){
            if(s[sx][sy] == '#') continue;
            vector<vector<i64>> dist(h, vector<i64>(w, -1));
            dist[sx][sy] = 0;
            queue<P> que;
            que.push(P(sx, sy));
            while(!que.empty()){
                P t = que.front();
                que.pop();
                rep(k, 4){
                    i64 nx  = t.first + dx[k];
                    i64 ny  = t.second + dy[k];
                    if(nx < 0 | nx >= h | ny < 0 | ny >= w) continue;
                    if(dist[nx][ny] == -1 && s[nx][ny] == '.'){
                        dist[nx][ny] = dist[t.first][t.second] + 1;
                        ans = max(ans, dist[nx][ny]);
                        que.push(P(nx, ny));
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.awt.geom.*;

import static java.lang.Math.*;
public class Main {
	final Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().init();
	}
	void init(){
		new AOJ1183();
	}
	
	class AOJ1183{
		AOJ1183(){
			while(sc.hasNext()){
				int n=sc.nextInt();
				if(n==0)	break;
				solve(n);
			}
		}
		Circle[] c;
		Point2D[][] p1;
		Point2D[] p2;
		void solve(int n){
			c=new Circle[n];
			for(int i=0; i<n; ++i)	c[i]=new Circle(sc.nextInt(), sc.nextInt(), sc.nextInt());
			p1=new Point2D[n-1][2];
			for(int i=0; i<n-1; ++i)	p1[i]=intersectPtCC(c[i], c[i+1]);
			p2=new Point2D[2*n];
			p2[0]=c[0].p;
			p2[2*n-1]=c[n-1].p;
			for(int i=0; i<n-1; ++i){
				p2[2*i+1]=p1[i][0];
				p2[2*i+2]=p1[i][1];
			}
			double[] dp=new double[2*n];
			for(int i=1; i<2*n; ++i)	dp[i]=Double.MAX_VALUE/4;
			for(int i=0; i<2*n; ++i)for(int j=i+1; j<2*n; ++j){
				if(i==j || !f1(i,j))	continue;
				dp[j]=min(dp[j], dp[i]+p2[j].distance(p2[i]));
			}
			System.out.println(dp[2*n-1]);
		}
		boolean f1(int from,int to){
			Line2D l=new Line2D.Double(p2[from],p2[to]);
			int f=(from+1)/2-1,t=(to+1)/2-1;
			for(int i=f+1; i<t; ++i)if(!new Line2D.Double(p1[i][0],p1[i][1]).intersectsLine(l))	return false;
			return true;
		}
		Point2D add(Point2D p1,Point2D p2){
			return new Point2D.Double(p1.getX()+p2.getX(), p1.getY()+p2.getY());
		}
		Point2D sub(Point2D p1,Point2D p2){
			return new Point2D.Double(p1.getX()-p2.getX(), p1.getY()-p2.getY());
		}
		Point2D mul(double n,Point2D p1){
			return new Point2D.Double(p1.getX()*n, p1.getY()*n);
		}
		Point2D normalVector1(Point2D p){
			return new Point2D.Double(-p.getY(), p.getX());
		}
		Point2D normalVector2(Point2D p){
			return new Point2D.Double(p.getY(), -p.getX());
		}
		class Circle{
			Point2D p;
			double r;
			Circle(double x,double y,double r){
				this.p=new Point2D.Double(x,y);
				this.r=r;
			}
		}
		Point2D[] intersectPtCC(Circle a,Circle b){
			double dis = a.p.distance(b.p);
			if(dis > a.r+b.r)	return null;
			Point2D v = sub(b.p, a.p);
			double rc = (dis*dis + a.r*a.r - b.r*b.r)/(2*dis);
			double rate = rc/dis;
			v = mul(rate, v);
			Point2D c = add(v, a.p);
			double disC2c = c.distance(b.p);
			double disqc = Math.sqrt(b.r*b.r - disC2c*disC2c);
			Point2D v2 = sub(b.p, c);
			v2 = mul(disqc/disC2c, v2);
			Point2D[] ret = new Point2D.Double[2];
			ret[0] = add(normalVector1(v2), c);
			ret[1] = add(normalVector2(v2), c);
			return ret;
		}
	}
}

Measured memory_bytes: 34132
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
#define rep(i,n) for (ll i = 0; i < (n); i++)
 
const ll mod = 998244353ll;
// const ll mod = 1000000007ll;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){ p("YES"); }else{ p("NO"); }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll mygcd(ll a, ll b){
    if(b > a)swap(a, b);
    if(a == b || b == 0)return a;
    return mygcd(b, a % b);
}
/*

ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    assert(n >= r);
    assert(n >= 0);
    assert(r >= 0);
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

// auto res = NTT::conv(mod, 3ll, atable, btable);

bool multicase = false;

ll n,m,num,a,b,c,d,e,q, w;
ll x[500005], y[500005];
ll sum, r, k;
string s;

void solve(){
    cin >> s;
    n = s.size() + 1;
    for(ll i=0;i<n-1;i++){
        if(s[i] == '<'){
            x[i+1] = x[i] + 1;
        }
    }
    for(ll i=n-2;i>=0;i--){
        if(s[i] == '>'){
            y[i] = y[i+1] + 1;
        }
    }
    ll ans = 0;
    for(ll i=0;i<n;i++){
        ans += max(x[i], y[i]);
        // pe(x[i]);p(y[i]);
    }
    p(ans);
    return;
}

int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 8732
#include<stdio.h>
#define MAX 2000000

void maxHeapify(int);

int H,A[MAX+1];

int main(){
  int i;
  
  scanf("%d",&H);
  
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  for(i=H/2;i>=1;i--){
    maxHeapify(i);
  }
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int i){
  int a,l,r,largest;

  l = 2*i;
  r = 2*i+1;

  if(l <= H && A[l] > A[i]){
    largest = l;
  } else {
    largest = i;
  }
  if(r <= H && A[r] > A[largest]){
    largest = r;
  }

  if(largest != i){
    a = A[i];
    A[i] = A[largest];
    A[largest] = a;
    maxHeapify(largest);
  }
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int>A(9);
  vector<bool>C(9,false);
  for(int X=0;X<9;X++){
    cin>>A[X];
  }
  int N;
  cin>>N;
  vector<int>B(N);
  for(int X=0;X<N;X++){
    cin>>B[X];
    for(int Y=0;Y<9;Y++){
      if(B[X]==A[Y]){
        C[Y]=true;
      }
    }
  }
  if(C[0]==true&&C[3]==true&&C[6]==true){
    cout<<"Yes"<<endl;
  }
  else if(C[1]==true&&C[4]==true&&C[7]==true){
    cout<<"Yes"<<endl;
  }
  else if(C[2]==true&&C[5]==true&&C[8]==true){
    cout<<"Yes"<<endl;
  }
  else if(C[0]==true&&C[1]==true&&C[2]==true){
    cout<<"Yes"<<endl;
  }
  else if(C[3]==true&&C[4]==true&&C[5]==true){
    cout<<"Yes"<<endl;
  }
  else if(C[6]==true&&C[7]==true&&C[8]==true){
    cout<<"Yes"<<endl;
  }
  else if(C[0]==true&&C[4]==true&&C[8]==true){
    cout<<"Yes"<<endl;
  }
  else if(C[2]==true&&C[4]==true&&C[6]==true){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

int a[10][10] = {0};

int main(void)
{
    int n, d;
    cin >> n >> d;
    for (size_t i = 0; i < n; i++)
    {
       for (size_t j = 0; j < d; j++)
       {
           int temp;
           cin >> temp;
           a[i][j] = temp;
       }
        /* code */
    }
    
    int count = 0;
    for (size_t i = 0; i < n; i++)
    {
       for (size_t j = i + 1; j < n; j++)
       {
           int sum = 0;
           for (size_t k = 0; k < d; k++)
           {
                int diff = a[i][k] - a[j][k];
                sum += diff * diff;
           }
            double sqrt_d = sqrt((double)sum);
            int sqrt_int = (int)sqrt_d;
            if(sqrt_d == sqrt_int){
                count++;
            }
            
       }
        /* code */
    }
    cout << count << endl;    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x, y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x, y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=pow(10,9)+7;
bool cmp(pair<long double ,int > x, pair<long double , int> y){ return x.F<y.F && x.S<y.S; }
const ll maxn=1e4+10;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
int main(){ 
    
//    #ifndef ONLINE_JUDGE
//  		freopen("input.txt", "r", stdin);
//    #endif
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for (int i=0;i<n;i++) cin>>a[i];
    if (k>=n){
    	cout<<0<<endl;
    	return 0;
	}
    sort(a, a+n);
    for (int i=0;i<k;i++) a[n-1-i]=0;
    ll ans=0;
    for (int i=0;i<n;i++) ans+=a[i];
    cout<<ans<<endl;
    
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;


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


int main(){
    int n, x;
    cin >> n >> x;
    int res = 1;
    int d = 0;
    for(int i = 0; i < n; i++){
        int l;
        cin >> l;
        d += l;
        if(d <= x){
            res++;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(c>a)a=c;
	if(b>d)b=d;
	if(b-a>0)printf("%d",b-a);
	else puts("0");
	return 0;
}

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

#define MAX 1000000

int main( void )
{
	vector <bool> primes(MAX+1, false);

	for ( int i = 3; i <= MAX; i += 2 )
	{
		primes[i] = true;
	}

	for ( int i = 3; i <= MAX; i += 2 )
	{
		if ( primes[i] )
		{
			for ( int j = i + i; j <= MAX; j += i )
			{
				primes[j] = false;
			}
		}
	}
	primes[2] = true;
	
	int n;
	while ( cin >> n )
	{
		int cnt = 0;
		if ( n >= 2 )
			cnt++;
		for ( int i = 3; i <= n; i += 2 )
		{
			if ( primes[i] )
				cnt++;
		}
		cout << cnt << endl;
	}

	return 0;
}

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

using namespace std;
using ll = long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  ll n, m, a, as = 0;
  cin >> n >> m;
  REP(i, m) {
    cin >> a;
    as += a;
  }

  cout << max(n - as, -1ll) << endl;;

  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std ;
int main(){
    int n , i ;
    cin >> n ;
    set<string> st ;
    for(i=0;i<n;++i){
        string tmp ; cin >> tmp ;
        st.insert(tmp) ;
    }
    cout << st.size() << "\n" ;
    return 0 ;
}

Measured memory_bytes: 19240
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for (int i=0;i<(int)(n);i++)
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    if (m%n==0) {
      cout<<(m/n)<<endl;
      return 0;
    }
    for (int i=m/n;i>0;i--){
      if ((m-i*(n-1))%i==0){
        cout<<i<<endl;
        return 0;
      }
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	int N, dummy;
	dummy = scanf("%d", &N);

	int tmp1, tmp2;
    int ans = 0; 
	for (int i = 0; i < N; i++) {
		dummy = scanf("%d", &tmp1);
		ans += tmp1 - 1;
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 128
n = gets.to_i
u = Array.new(n + 1, 0)
1.upto(10000) do |x|
  a = x * x
  break if a > n
  1.upto(10000) do |y|
    b = a + y * y + x * y
    break if b > n
    1.upto(10000) do |z|
      break if b + z * z + x * z + y * z > n
      u[b + z * z + x * z + y * z] += 1 if b + z * z + x * z + y * z <= n
    end
  end
end
1.upto(n) do |i|
  puts u[i]
end

Measured memory_bytes: 14308
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define mk make_pair
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);

int main()
{
  hs;
  ll a;
  cin>>a;
  ll c[a];
  unordered_map<ll,ll> mp;
  for(ll i=0;i<a;i++)
  {
    cin>>c[i];
    mp[c[i]]++;
  }
  ll count=0;
  for(ll i=0;i<a;i++)
  {
    bool flag=true;
    for(ll j=2;j*j<=c[i];j++)
    {
      if(c[i]%j==0)
      {
        if(mp[c[i]/j]||mp[j])
        {
          flag=false;
          break;
        }
      }
    }
    if(mp[c[i]]>1)
    flag=false;
    if(c[i]!=1&&mp[1])
    flag=false;
    if(flag)count++;
  }
  cout<<count<<endl;
}


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


int main(){


  int H = 0 , W = 0 ;

    
  while (1){
 
      
      cin >> H >> W ;

      if ( H == 0 && W == 0 ) break ;


      for ( int h = 0 ; h < H ; h++ ){

	for ( int w = 0 ; w < W ; w++ ){

	  if ( 0 < h && h < H - 1 && 0 < w && w < W - 1 ){

	    cout << "." ;

	  } else {

	    cout << "#" ;

	  }


	}

	  cout << endl ;

	 
      }
      

      cout << "\n" ;   
  
  }



  return 0 ;


}

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

int main()
{
    int N;
    cin>>N;
    vector<int> A(N);
    for (int &a: A)
        cin>>a, a--;

    //  C1[a] = num(a)
    vector<int> C1(N);
    for (int a: A)
        C1[a]++;
    //  C2[c] = num(c)
    vector<int> C2(N+1);
    for (int c: C1)
        C2[c]++;
    //  S[x] = sum(C2[x:])
    vector<int> S(N+1);
    S[N] = C2[N];
    for (int i=N-1; i>=0; i--)
        S[i] = S[i+1]+C2[i];
    //  T[c] = sum(min(c, x) for c in C1)
    vector<int> T(N+1);
    for (int i=1; i<=N; i++)
        T[i] = T[i-1]+S[i];

    auto f = [&](int k, int n)
    {
        return n<=N && n<=T[n]/k;
    };

    int B = 1;
    while (B<N)
        B *= 2;

    for (int k=1; k<=N; k++)
    {
        int ans = 0;
        for (int b=B; b>=1; b/=2)
            if (f(k, ans+b))
                ans += b;
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 8192