akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int N,M;cin>>N>>M;
    vector<set<int>> G(N);
    rep(i,M){
        int a,b;cin>>a>>b;
        a--,b--;
        G[a].insert(b),G[b].insert(a);
    }
    vl v;
    rep(i,N)v.push_back(i);
    int ans=0;
    do{
        if(v[0]!=0)break;
        int now=0;
        rep(i,N-1)if(G[v[i]].count(v[i+1]))now++;
        if(now==N-1)ans++;
    }while(next_permutation(all(v)));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 764
while True:
    n,x = [int(i) for i in input().split()]
    if n == 0 and x == 0: break
    count = 0
    # 3????????°?????????????°????x//3?????????x//3 * 3 == x ?????????????°????x//3??\?????§?????????????????????
    for a in range(1, x//3):
        # 3????????°?????????????????????x//2?????????x//2 * 2 == x ?????????????????????x//2??\?????§?????????????????????
        for b in range(a+1,x//2):
            c = x - (a + b)
            if b < c <= n:
                count += 1
    print(count)

Measured memory_bytes: 7712
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
using ll=long long;
int main(){
  ll N;
  vector<ll> Sub;
  cin>>N;
  for(ll i=0;i<N;++i){
    ll tmp;
    cin>>tmp;
    Sub.push_back(tmp);
  }
  for(ll i=0;i<N;++i){
    ll tmp;
    cin>>tmp;
    Sub[i]-=tmp;
  }
  sort(Sub.begin(),Sub.end());
  /*for(auto s:Sub){
    cout<<s<<endl;
  }*/
  ll husoku=0;
  int num=0;
  for(ll i=0;i<N;++i){
   // cout<<Sub[i]<<endl;
    if(Sub[i]>=0)break;
    husoku+=Sub[i];
    num++;
  }
  for(ll i=Sub.size()-1;i>=0;--i){
    if(husoku>=0)break;
    if(Sub[i]<=0)break;
    husoku+=Sub[i];
    num++;
  }
  if(husoku<0){
    cout<<-1<<endl;
  }else{
    cout<<num<<endl;
  }
  return 0;
}

Measured memory_bytes: 1528
n = int(input())
s = list(map(int, input().split()))

cnt = 1
res = 0
for i in range(1, n):
  if s[i] == s[i-1]:
    cnt +=1
  else:
    res += int(cnt//2)
    cnt = 1
res += int(cnt//2)

print(res)

Measured memory_bytes: 3064
def jsc19q_a():
    M, D = map(int, input().split())
    ans = 0
    for m in range(1, M+1):
        for d in range(1, D+1):
            d1 = d % 10
            d //= 10
            d2 = d % 10
            if d1 < 2 or d2 < 2: continue
            if d1 * d2 == m: ans += 1
    print(ans)

jsc19q_a()

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

using namespace std;
#define ll long long

const int N = 1e5 + 5;
ll INF = 1e9 + 7;


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;

    bool flag = true;
    int maxVal = 0;
    int count = 0;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
        if(a==b)
        {
            count++;
        }
        else
        {
            count = 0;
        }
        maxVal = max(maxVal,count);
    }

    if(maxVal >=3)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define float double 
#define dg(x) cout<<#x<<" :"<<x;
#define dg_array(ar) for(auto x : ar) cout<<x<<" ";cout<<endl;
#define dg_2darray(ar) for(auto x : ar) {for(auto y : x) cout<< y<<" ";cout<<endl;}
#define endl '\n'
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
void solve()
{
    int total , n;
    cin >> total  >> n;
    int sum =0;
    for(int i =0 ;i < n; i++) 
    {
        int x; 
        cin >> x;
        sum += x;
    }
    total -= sum;
    if(total < 0)
        cout<< -1 << endl;
    else
    {
        cout<< total << endl;
    }
    
}

void testcase()
{
    int t;
    cin>>t;
    while(t--)
        solve();
}
int32_t main(){
	fast;
//    testcase();           
   solve();              
}

Measured memory_bytes: 3652
#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() {
  string s, t; cin >> s >> t;
  int ans = s.size();
  for (int i = 0; i < (int)(s.size()-t.size()+1); ++i) {
    int cur = 0;
    for (int j = 0; j < (int)t.size(); ++j) {
      if (s[i+j] != t[j]) ++cur;
    }
    ans = min(ans, cur);
  }
  cout << ans;
}

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


Measured memory_bytes: 3632
import java.util.Scanner;
import java.lang.Math;
public class Main {
  public static void main (String[]args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();

    int ans = 0;
    if(B/A > C){
      ans = C;
    } else{
      ans =  B/A;
    }
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 23124
#include <iostream>
#include <queue>
#define N 100
#define INFINITY 2000000000
using namespace std;
int bfs();
int n,r,k,t,p,s,g,v,u,M[N][N],d[N],result;
string color[N];
int main(){
  int i,j;
  cin >> n;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    cin >> r >> k;
    for(j=0;j<k;j++){
      cin >> t;
      M[r-1][t-1]=1;
    }
  }
  cin >> p;
  for(i=0;i<p;i++){
    cin >> s >> g >> v;
    s--,g--;
    result=bfs();
    if(result!=0) cout << result << endl;
    else cout << "NA" << endl;
  }
  return 0;
}
int bfs(){
  int i,j;
  queue<int> q;
  for(i=0;i<n;i++) color[i]="WHITE",d[i]=INFINITY;
  color[s]="GLAY";
  d[s]=0;
  q.push(s);
  while(q.empty()!=1){
    u=q.front();
    q.pop();
    for(i=0;i<n;i++){
      if(M[u][i]&&color[i]=="WHITE"){
	color[i]="GLAY";
	d[i]=d[u]+1;
	q.push(i);
      }
    }
    color[u]="BLACK";
  }
  v-=d[g];
  if(v>0) return d[g]+1;
  return 0;
}

Measured memory_bytes: 1252
import math, bisect
N, M = map(int, input().split())

def f(x):
  l = []
  for i in range(1, int(math.sqrt(x)+1)):
    if x % i == 0:
      l.append(i)
      l.append(x//i)
  l.sort()
  return l

fac = f(M)
print(fac[bisect.bisect_right(fac, M//N)-1])


Measured memory_bytes: 3060
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  n,m = list(map(int,input().split()))
  a = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  su = 0
  lis = []
  
  for i in range(n):
    su += a[i] 
  a.sort(reverse = True)
  
  for i in range(m):
    if a[i] < su/(4*m):
      print("No")
      exit()
  print("Yes")

if __name__ == '__main__':
  main()

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

using namespace std;

int main(){
    int n,d;
    cin>>n>>d;
    vector<vector<int>> x(n);
    set<int> heiho;
    for (int i = 0; i < 10000; ++i) {
        heiho.insert(i*i);
    }
    int ans=0;
    for (int i = 0; i < n; ++i) {
        int xi;
        for (int j = 0; j < d; ++j) {
            cin>>xi;
            x[i].push_back(xi);
        }

        for (int j = 0; j < i; ++j) {
            int dis=0;
            for (int k = 0; k < d; ++k) {
                dis+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            if(heiho.find(dis)!=heiho.end())++ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 768
<?php

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 'Off');

// define('DEBUG', true);
define('DEBUG', false);

$a = $b = array();
$ans = 0;

fscanf(STDIN, "%d %d", $N, $H);
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d %d", $a[$i], $b[$i]);
}

$aMax = max($a);
sort($b);

while (true) {
    $curB = array_pop($b);

    if ($curB > $aMax) {
        $H -= $curB;
        $ans++;
    } else {
        echo ($ans + (int)ceil($H / $aMax)) . PHP_EOL;
        exit;
    }

    if ($H <= 0) {
        echo $ans . PHP_EOL;
        exit;
    }
}


Measured memory_bytes: 15988
#include<iostream>
using namespace std;
signed main(){
  int a,b;
  cin>>a>>b;
  if(a<b)
    cout<<"a < b\n";
  else
    if(a>b)
      cout<<"a > b\n";
    else
      if(a==b)
	cout<<"a == b\n";
  return (0);
}



Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
// string s[101];
int main()
{
	     //    #ifndef ONLINE_JUDGE
      //  // for getting input from input.txt
      //  freopen("input.txt", "r", stdin);
      //  // for writing output to output.txt
      //  freopen("output.txt", "w", stdout);
      // #endif

	int n,l;
	cin>>n>>l;
	vector<string> s(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>s[i];
	}
	sort(s.begin(), s.end());
	for (int i = 0; i < n; ++i)
	{
		/* code */
		cout<<s[i];
	}
	return 0;
}


Measured memory_bytes: 256
// g++ -std=gnu++1y -O2 xxx.cpp

#include <bits/stdc++.h>
//#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,l,r)for(int i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31)) /*オーバーフローしない程度に大きい数*/
#define MOD 1000000007

int main() {
    int N; cin>>N;
    vector<int> h(N+1);
    rep(i,1,N+1) cin>>h[i];
    
    int dp[N+1];
    memset(dp, 0, sizeof(dp));

    int ans;
    rep(i,2,N+1) {
        if (i-2>=1) dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
        else dp[i]=dp[i-1]+abs(h[i-1]-h[i]);
    }
    ans=dp[N];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
typedef vector<i64> vi;
typedef vector<vi> vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

void Main()
{
  i64 k;
  cin >> k;

  vi a(k);
  rep(i,k) cin >> a[i];

  i64 ma = 2, mi = 2;

  rep(i,k){
    i64 g = a[k-1-i];
    mi = ((mi+g-1)/g) * g;
    ma = (ma/g) * g + g - 1;
    if(mi>ma){
      cout << -1 << endl;
      return;
    }
  }

  cout << mi << " " << ma << endl;
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

const int MAX = 1000005;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}


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

    COMinit();
    ll N; cin >> N;
    vector<ll> x(N+1);
    rep(i, N) cin >> x[i+1];
    vector<ll> cum(N+1, 0);
    cum[1] = 1;
    repr(i, 2, N) { cum[i] = cum[i-1] + modpow(i, mod-2); chmod(cum[i]); }
    
    ll ans = 0;
    repr(i, 1, N) {
        ll add = (x[i+1] - x[i]) * cum[i] % mod;
        ans += add;
        chmod(ans);
    }
    ans *= fac[N-1];
    chmod(ans);
    cout << ans << endl;

    return 0;
}


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

using namespace std;

#define ll long long
#define ld long double

#define P pair<ll, ll>
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, m, n) for (ll i = n; i >= (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define sortAl(v) sort(v.begin(), v.end())
#define sortAlr(v)                                                             \
  sort(v.begin(), v.end());                                                    \
  reverse(v.begin(), v.end())
#define cout(n) cout << fixed << setprecision(n)

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
template <class T> inline void chmax(T &a, T b) { a = std::max(a, b); }
template <class T> inline void chmin(T &a, T b) { a = std::min(a, b); }

#define mod (int)(1e9 + 7)
#define INF LLONG_MAX

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

  ll N;
  cin >> N;

  if (N == 0) {
    cout << 0 << endl;
  } else {
    ll v[10000] = {};
    ll sum[10000] = {};

    ll digit = 1;

    // 何桁かをまずは求める
    while (1) {
      if (digit == 1) {
        v[1] = 1;
        sum[1] = 1;
      } else {
        v[digit] = v[digit - 1] * -2;
        sum[digit] = sum[digit - 2] + v[digit];
      }
      if (N > 0 && sum[digit] > 0) {
        if (N <= sum[digit]) {
          break;
        }
      } else if (N < 0 && sum[digit] < 0) {
        if (N >= sum[digit]) {
          break;
        }
      }
      digit++;
    }

    // 2つ前までの桁でこの値が表せない場合、1となる
    for (ll i = digit; i > 0; i--) {
      // 同符号なら
      if (N * v[i] > 0 && abs(N) > abs(sum[i - 2])) {
        cout << 1;
        N -= v[i];
      } else {
        cout << 0;
      }
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 384
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;
void BubbleSort(vector<string> &a,int n){
    for(int i=0; i<n; i++){
        for(int j=n-1; j>i; j--){
            if(a[j][1]<a[j-1][1]) swap(a[j],a[j-1]);
        }
    }
    return;
}
void selectionSort(vector<string> &a,int n){
    int count=0;
    for(int i=0; i<n-1; i++){
        int minj=i;
        for(int j=i; j<n; j++){
            if(a[j][1]<a[minj][1]) minj=j;
        }
        swap(a[i],a[minj]);
    }
    return;
}
int main(){
    int n,ans;
    bool isstable=true;
    cin >> n;
    vector<string> a0(n);
    vector<string> a1(n);
    for(int i=0; i<n; i++){
        cin >> a0[i];
        a1[i]=a0[i];
    }
    BubbleSort(a0,n);
    for(int i=0; i<n-1; i++) cout << a0[i] << " ";
    cout << a0[n-1] << endl;
    cout << "Stable" << endl;
    selectionSort(a1,n);
    for(int i=0; i<n-1; i++){
        cout << a1[i] << " ";
        if(a0[i]!=a1[i]) isstable=false;
    }
    cout << a1[n-1] << endl;
    if(isstable) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
}



Measured memory_bytes: 3200
#include<stdio.h>
#include<string.h>
using namespace std;

#define N 256

char* changeline(char ch[N]);

int main(){
	int num=0;
	char* str1=new char[N];
	char* str2=new char[N];
	memset(str1,'\0',N);
	memset(str2,'\0',N);
	int tmp=0;
	while((tmp=getchar()) !='\n'){
		str1[num]=(char)tmp;
		num++;
	}
	num=0;
	while((tmp=getchar()) !='\n'){
		str2[num]=(char)tmp;
		num++;
	}
	for(int i=0; i<strlen(str1); i++){
		if(strstr(str1, str2)==NULL){
			str1=changeline(str1);
		}else{
			printf("Yes\n");
			break;
		}
		if(i==strlen(str1)-1){
			printf("No\n");
			break;
		}
	}
}

//文字列並べ替え
char* changeline(char ch[N]){
	char tmp ='\0';
	tmp=ch[0];
	for(int i=0; i<strlen(ch); i++){
		ch[i]=ch[i+1];
	}
	ch[strlen(ch)]=tmp;
	return ch;
}



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

const string YES = "Yes";
const string NO = "No";

void solve(long long X) {
    if (X >= 30) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
}

int main() {
    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}


Measured memory_bytes: 3768
N, M = map(int, input().split())
maxL = 0
minR = float('inf')
for i in range(M):
    L, R = map(int, input().split())
    maxL = max(maxL, L)
    minR = min(minR, R)
if minR - maxL >= 0:
    print(minR - maxL + 1)
else:
    print(0)   

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>

using namespace std;
int main() {
	long long lucas[100];
	lucas[0] = 2;
	lucas[1] = 1;
	for (int i = 2; i < 88; i++) {
		lucas[i] = lucas[i - 2] + lucas[i - 1];
	}
	int n;
	cin >> n;
	cout << lucas[n] << endl;

	return 0;
}



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

int main(){
	int h,w,k;
	cin >> h >> w >> k;
	string c[h];
	for(int i =0;i<h;i++)
		cin >> c[i];

	int ans = h*w+1;
	int pref[h+1][w+1];
	memset(pref,0,sizeof(pref));
	for(int i =1;i<=h;i++){
		for(int j =1;j<=w;j++){
			pref[i][j] = pref[i-1][j]+pref[i][j-1] - pref[i-1][j-1] + (c[i-1][j-1]=='1');
			// cout << pref[i][j] << " ";
		}
		// cout << endl;
	}
	for(int i =0;i<=(1<<(h-1));i++){
		//find where to cut horizontally first;
		int hs = i;
		vector<int> cuts;
		int hcut = 1;
		// int cnt1s=0;
		cuts.push_back(0);
		while(hs>0){
			if(hs&1)
				cuts.push_back(hcut);
			hcut++;
			hs>>=1;
		}
		int cur = cuts.size()-1;
		cuts.push_back(h);
		int j = 1;
		// int py =0,px = 0;
		int py = 0;
		// int req = 1;
		int good = 1;
		while(j<=w){
			// cout << j << " " << py <<" " << i <<  endl;
			for(int i =0;i<cuts.size()-1;i++){
				if(pref[cuts[i+1]][j]+pref[cuts[i]][py] - pref[cuts[i+1]][py]-pref[cuts[i]][j]>k){
					// need to stop the one before this j was the cut
					// if(j==3 && py==2){
					// 	cout <<pref[cuts[i+1]][j]<< " " << pref[cuts[i]][py]<< " "<<  pref[cuts[i+1]][py]<< " " << pref[cuts[i]][j]<< endl;
					// 	exit(0);
					// }
					cur++;
					j--;
					int olpy = py;
					py = j;
					if(py==olpy){
						good = 0;
					}
					break;
				}
			}
			if(!good)break;
			j++;
		}
		if(good)
		ans = min(cur,ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int a, b, ret = -1;
  cin >> a >> b;
  for (int k = 1; k <= 1000000; ++k) {
    if (k * 8 / 100 == a && k / 10 == b) {
      ret = k;
      break;
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  ll N;
  cin >> N;
  vector<ll> L(N);
  for (ll i=0; i<N; i++) cin >> L[i];
  sort(L.begin(), L.end());
  ll res = N*(N-1)*(N-2)/6;
  for (ll i=0; i<N; i++) {
    for (ll j=i+1; j<N; j++) {
      auto Iter = lower_bound(L.begin(), L.end(), L[i]+L[j]);
      res -= L.end()-Iter;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * 3065.cc: How old are you
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  ll a = 0, b = 1;
  
  while (n--) {
    int q, x;
    scanf("%d%d", &q, &x);

    if (q == 1) a *= x, b *= x;
    else if (q == 2) a += x;
    else a -= x;
  }

  printf("%lld %lld\n", -a, b);
  return 0;
}



Measured memory_bytes: 3204
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000;

using ll = long long;
using namespace std;

int main(){
    int k;
    cin >> k;
    vector<ll> a;
    for (int i=1; i<=9; i++) a.push_back(i);
    while(1){
        if (k<=a.size()){
            cout << a[k-1] << endl;
            return 0;
        }
        k -= a.size();
        // oldに一桁くっつけたものをaに格納していく
        vector<ll> old;
        swap(old, a);
        for(ll x : old){
            for (int i=-1; i<=1; i++){
                int d = x%10 + i;
                if(d<0 || d>9) continue;
                ll nx = x*10 + d;
                a.push_back(nx);
            }
        }
    }
    return 0;
}



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

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

int get2(int n){
    int c=0;
    int r=n%2;
    int q=n/2;
    while(!r){
        c++;
        r=q%2;
        q/=2;
    }
    return c;
}

int main()
{
    int n;cin >> n;
    long long int res=0;
    for(int i=0;i<n;i++){
        int tmp;cin >> tmp;
        res += get2(tmp);
    }
    p(res)
} 

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    val c = readLine()!!.toInt()
    val x = readLine()!!.toInt()

    var cnt = 0
    for (n500 in 0..a) {
        for (n100 in 0..b) {
            for (n50 in 0..c) {
                if (x == n500 * 500 + n100 * 100 + n50 * 50) {
                    cnt++
                }
            }
        }
    }
    print(cnt)
}


Measured memory_bytes: 34528
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//https://onlinejudge.u-aizu.ac.jp/solutions/problem/ALDS1_5_B/review/2709881/arsenic28/Rust
trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let mut chain:i64 = 0;
    let mut r_list: Vec<i64> = Vec::new();
    let mut l_list: Vec<i64> = Vec::new();

    let mut pre = 'R';
    for c in s.iter(){
        if *c == pre {
            chain += 1;
        }else{
            if pre == 'R' {
                r_list.push(chain);
            }else{
                l_list.push(chain);
            }
            chain = 1;
            pre = *c;
        }
    }
    l_list.push(chain);

    let mut squares = vec![0;s.len()];
    let mut offset = 0;

    for i in 0..r_list.len(){
        let ave = (r_list[i] + l_list[i]) / 2;
        if (r_list[i] - l_list[i]).abs() % 2 == 0 {
            squares[(r_list[i]-1) as usize + offset] = ave;
            squares[r_list[i] as usize + offset] = ave;
            offset += (r_list[i] + l_list[i]) as usize;
        }else{
            if r_list[i] > l_list[i] {
                if r_list[i] % 2 == 0 {
                    squares[(r_list[i]-1) as usize + offset] = ave;
                    squares[r_list[i] as usize + offset] = ave + 1;
                }else{
                    squares[(r_list[i]-1) as usize + offset] = ave + 1;
                    squares[r_list[i] as usize + offset] = ave;
                }
                offset += (r_list[i] + l_list[i]) as usize;        
            }else{
                if l_list[i] % 2 == 0 {
                    squares[(r_list[i]-1) as usize + offset] = ave + 1;
                    squares[r_list[i] as usize + offset] = ave;
                }else{
                    squares[(r_list[i]-1) as usize + offset] = ave;
                    squares[r_list[i] as usize + offset] = ave + 1;
                }
                offset += (r_list[i] + l_list[i]) as usize;        
            }
        }
    }

    //println!("{:?}",r_list);
    //println!("{:?}",l_list);
    println!("{}",squares.iter().join(" "));
}


Measured memory_bytes: 9412
#include "bits/stdc++.h"
using namespace std;
#define LEN 100005
typedef struct pp{
	char name[100];
	int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
	Q[tail]=x;
	tail=(tail+1)%LEN;
}
P dequeue(){
	P x=Q[head];
	head=(head+1)%LEN;
	return x;
}
int min(int a,int b){return a<b?a:b;}

int main() {
int elaps=0,c;
int i,q;
P u;
scanf("%d %d",&n,&q);
for (int i = 1; i <= n; ++i) {
	scanf("%s",Q[i].name);
	scanf("%d",&Q[i].t);
}
head=1;tail=n+1;
while(head!=tail){
	u=dequeue();
	c=min(q,u.t);
	u.t-=c;
	elaps+=c;
	if(u.t>0)enqueue(u);
	else{
		printf("%s %d\n",u.name,elaps);
	}
}
return 0;
}

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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if (a+b==c+d){
		cout<<"Balanced";
	}
	else if (a+b>c+d){
		cout<<"Left";
	}
	else {
		cout<<"Right";
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	bool flag=true;
	string a, b;
	cin >> a;
	cin >> b;

	if(a[0]!=b[2]){ 
		flag = false;
		cout << "NO" << endl;
		return 0;
	}
	if(a[1]!=b[1]){
		flag = false;
	 cout << "NO" << endl;
	 return 0;
	}
	if(a[2]!=b[0]) {
		flag = false;
		cout << "NO" << endl;
		return 0;
	}
	if(flag==true){
		cout << "YES" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

print("Yes" if sum(int(x) for x in input().split()) % 9 == 0 else "No")

Measured memory_bytes: 85536
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Data.List
import Control.Monad

readLine :: Read a => IO [a]
readLine = map read . words <$> getLine

calc :: [Int] -> [Int] -> Int -> Int -> Int -> Int
calc ca cb i j k
    | null ca = 0
    | null cb = 0
    | head ca > k = 0
    | head ca + head cb > k = calc ca (tail cb) i (j-1) k
    | otherwise = maximum [i+j, calc (tail ca) cb (i+1) j k]

main :: IO ()
main = do
    [n, m, k] <- readLine
    a <- readLine
    b <- readLine
    let ca = scanl (+) 0 a
    let cb = scanl (+) 0 b
    print $ calc ca (reverse cb) 0 m k

Measured memory_bytes: 403972
import sys


N = int(sys.stdin.readline().rstrip())



# 1 <= N <= 10000

# 1 ~ 9 -> 9
# 100 ~ 999 -> 1000
# 10000 ~ 99999 -> 100000

a = range(1, N + 1)
A = [a for a in a if 1 <= a <= 9]
B = [a for a in a if 100 <= a <= 999]
C = [a for a in a if 10000 <= a <= 99999]
print(len(A) + len(B) + len(C))


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

int main(){
  int N;
  bool flag = false;
  cin >> N;
  for(int i=0;i<=N/4;i++){
    for(int j=0;j<=N/7;j++){
      int price = 4*i + 7*j;
      if(price == N)flag = true;
    }
  }
  if(flag == true){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main() {
    string n;
  
 
   cin >> n;
  
  int ans = 0;
  
for(int i = 0;i<n.size();i++){
  
  if(n[i]=='+'){
    
    ans++;
    
  }else if(n[i]=='-'){
    ans--;
  }
     

}
  
   cout << ans << endl;
 
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define N 100010
ll n,p[N];
vector<ll> e[N];

ll ans,f[N],g[N],h[N];
void solve(ll x,ll from){
    ll sigg=0;
    for(auto y:e[x])if(y!=from){
	solve(y,x);
	if(g[y]-2>0)sigg+=g[y]-2;
    }
    g[x]=sigg+p[x];
    vector<ll> v;
    for(auto y:e[x])if(y!=from){
	ll ff=f[y]-1;
	ll gg=g[y]-2; if(gg<0)gg=0;
	v.push_back(ff-gg);
    }
    f[x]=p[x],h[x]=-1e17;
    if(v.size()>=1){
	sort(v.begin(),v.end(),greater<ll>());
	f[x]=max(f[x],sigg+p[x]+v[0]);
    }
    if(v.size()>=2){
	h[x]=sigg+p[x]+v[0]+v[1];
    }
    for(auto y:e[x])if(y!=from){
	ll hh=h[y]-2;
	ll gg=g[y]-2; if(gg<0)gg=0;
	h[x]=max(h[x],sigg+p[x]+hh-gg);
    }
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
	cin>>p[i];
    }
    for(int i=0;i<n-1;i++){
	ll a,b;cin>>a>>b;
	e[a].push_back(b);
	e[b].push_back(a);
    }
    ans=-1e17;
    solve(1,0);
    for(int i=1;i<=n;i++){
	ans=max(ans,f[i]);
	ans=max(ans,g[i]);
	ans=max(ans,h[i]);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 25824
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int n, a[100];

int f(int p, int q, int h)
{
    if (p > q) return 0;
    int mi = p;
    for (int i = p + 1; i <= q; ++i)
        if (a[i] < a[mi])
            mi = i;

    return a[mi] - h + f(p, mi - 1, a[mi]) + f(mi + 1, q, a[mi]);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    cout << f(0, n - 1, 0);
}


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

int main(){
  int x,a,b,c,d;
  cin>> x >> a >>b;
  c=x-a;
  d=x-b;
  if(c<0){
   c*=-1;
  }
  if(d<0){
    d*=-1;
  }
  if(c<d){
cout << "A";
  }else if(c>d){
    cout << "B";
  }
return 0;
}


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

  
public class Main { 
  
    static BufferedReader in;
    static PrintWriter out = new PrintWriter(System.out);
    static String file = "in";
    static int test = 10; // 0 for local testing, 1 for std input
    static int inf = 1_000_000;

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

    void swap(int[]ary, int i, int j)
    {
        int t = ary[i];
        ary[i] = ary[j];
        ary[j] = t;
    }
    
    String[] split() throws Exception
    {
        return in.readLine().split(" ");
    }

    int readInt() throws Exception
    {
        return Integer.valueOf(in.readLine());
    }

    int[] toIntArray() throws Exception
    {
        String[] sp = split();
        int n = sp.length;
        int[] ary = new int[n];
        for(int i = 0; i < n; i++) ary[i] = Integer.valueOf(sp[i]);
        return ary;
    }

    String reverse(String str)
    {
        return new StringBuilder(str).reverse().toString();
    }

    public static void main(String[] args) throws Exception
    {
        int _k = Integer.valueOf("1");
        if(test > 0) in = new BufferedReader(new InputStreamReader(System.in));
        else in = new BufferedReader(new FileReader(file));
        if(test < 0) {String[] str = in.readLine().split(" ");}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/

        new Main().b();
        out.flush();
    }

    void b() throws Exception
    {
        int n = readInt();
        int[][] points = new int[n][2];
        for(int i = 0; i < n; i++)
        {
            points[i] = toIntArray();
        }
        
        int re = 0;

        Map<Integer, Map<Integer, Integer>> map = new HashMap<>();

        int maxi = 0;

        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < n; j++)
            {
                if(i == j) continue;
                int dx = points[j][0] - points[i][0],
                    dy = points[j][1] - points[i][1];
                if(!map.containsKey(dx))
                {
                    map.put(dx, new HashMap<>());
                }
                Map<Integer, Integer> xmap = map.get(dx);
                xmap.put(dy, xmap.getOrDefault(dy, 0) + 1);
                maxi = Math.max(maxi, xmap.get(dy));
            }
        }

      	out.println(n - maxi);
    }

    String getSlope(int[] a, int[] b)
    {
        int dx = b[0] - a[0], dy = b[1] - a[1];
        if(dx == 0) return "null";
        int gcd = gcd(dx, dy);
        return "" + (dy / gcd) + "/" + (dx / gcd);
    }
}


Measured memory_bytes: 22100
#include<stdio.h>
int main()
{int a,b;
int m,n;
scanf("%d%d",&m,&n);
if(m<n)
{b=m;
m=n;
n=b;
	}
while(n)
{  a=m%n;
   m=n;
   n=a;
}
printf("%d\n",m);
return 0;}


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

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

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

    int t2 = 4*x - y;
    if(t2<0 || t2%2==1){
        cout << "No" << endl;
        return 0;
    }

    int t = t2/2;
    int k = x - t;

    if(k>=0) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 3644
N = int(input())

def isOk(k):
    n = N
    while n % k == 0:
        n //= k
    return n % k == 1

if N <= 10**6:
    ans = 0
    for i in range(2, N + 1):
        if isOk(i):
            ans += 1
    print(ans)
    exit()

ans = 0
V = set()
for i in range(2, int(N**0.5) + 10):
    if isOk(i):
        ans += 1
        V.add(i)

# 約数の全列挙
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort(reverse=True)  # ソート
    return divisors

divN = divisors(N - 1)

ans += len([d for d in divN if not d in V])
print(ans)


Measured memory_bytes: 3188
#include <iostream>

using namespace std;

inline int xi(const int x, const int i, const int T){ return x + (T+1)*i; }

int main(){
	int N, T, S;

	cin >> N >> T >> S;

	int *A = new int[N+1];
	int *B = new int[N+1];

	for(int i=1; i<=N; i++) cin >> A[i] >> B[i];

	int *dp = new int[(N+1) * (T+1)];	//動的計画法のための配列
	
	//dpの初期値
	dp[0] = 0;
	for(int i=1; i<(N+1)*(T+1); i++) dp[i] = -1;

	int M = 0;

	//動的計画法でMを求める
	for(int i=1; i<=N; i++){
		for(int x=0; x<=T; x++){

			// i-1行目 x列が 0以上なら分岐へ
			if(dp[xi(x, i-1, T)] >= 0){

				//遊ぶ場合 -> 時間が Tを超えないかチェック
				if(x + B[i] <= S) dp[xi(x, i, T) + B[i]] = dp[xi(x, i-1, T)] + A[i]; 
				else if(x > S){
					if(x + B[i] <= T) dp[xi(x, i, T) + B[i]] = dp[xi(x, i-1, T)] + A[i];
				}
				else{
					if( (S + B[i] <= T) && (dp[xi(S, i, T) + B[i]] < dp[xi(x, i-1, T)] + A[i]) ) dp[xi(S, i, T) + B[i]] = dp[xi(x, i-1, T)] + A[i];
				}

				//遊ばない場合 -> 既に更新された値と比較 -> 大きいほうを採用
				if(dp[xi(x, i, T)] < dp[xi(x, i-1, T)]) dp[xi(x, i, T)] = dp[xi(x, i-1, T)];
			}
		}
	}

	//一番大きい値を取る
	for(int x=0; x<=T; x++){
		if(M < dp[xi(x, N, T)]) M = dp[xi(x, N, T)];
	}

	cout << M << endl;

	delete[] A;
	delete[] B;
	delete[] dp;

	return 0;
}

Measured memory_bytes: 36392
#include<iostream>
#include<string>
using namespace std;
 
int main(){
  int a = 0, b = 0, c = 0;
  string s;
  cin >> s;
  for(int i = 0;i < 3;i++){
    if(s.at(i) == 'a'){
      a++;
    }
    else if(s.at(i) == 'b'){
      b++;
    }
    else if(s.at(i) == 'c'){
      c++;
    }
  }
  if(a == 1&& b == 1 && c == 1){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}
 

Measured memory_bytes: 3528
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//
//using namespace __gnu_pbds;
using namespace std;

#define pb                     push_back
#define ll                     long long
#define forn(i,n)              for(int i=0; i<(int)n; i++)
#define forn1(i,n)              for(int i=1; i<=(int)n; i++)

#define sfd(a)                 scanf("%d", &a)
#define sffd(a,b)              scanf("%d%d", &a, &b)
#define sffl(a,b)              scanf("%lld%lld", &a,&b)
#define sfl(a)                 scanf("%lld", &a)

#define pii                    pair<int , int>
#define pll                    pair<ll , ll>
#define ff                     first
#define ss                     second
#define mem(a, val)            memset(a, val, sizeof(a))
#define all(x)                 (x).begin(), (x).end()

#define mx                     200005
#define INF_mx                 1e18
#define gcd(a,b)               __gcd(a, b)
#define lcm(a,b)               (a*b)/__gcd(a,b)
#define PRINT                  cout<<"hi"<<endl
#define PI acos(-1)
#define fast_in_out          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Q    int q; cin>>q; while(q--)
/*
tree<
       int,
     null_type,
     less<int>,
     rb_tree_tag,
     tree_order_statistics_node_update>t;
*/

int main()
{
   int n;
   cin>>n;
   int a[n];
   map<int, int>mp;
   for(int i=0; i<n; i++){
    cin>>a[i];
    mp[a[i]]++;
   }
    ll ans=0;
   for(int i=1; i<=n; i++)
   {
       ll tm=mp[i];
       tm=tm*(tm-1)/2;
       ans+=tm;
   }
   for(int i=0; i<n; i++){
      ll tm=mp[a[i]];
      tm=(tm*(tm-1)/2)-( (tm-1)*(tm-2)/2 );
      printf("%lld\n", ans-tm);
   }
    return 0;
}
/*

 6 4

 2 4 5
 0

*/


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    vector<pair<ll, ll> > vct(n);
    for(int i=0;i<n;i++){
        ll input;
        cin>>input;
        vct[i].first = input;
        vct[i].second = i+1;
    }
    sort(vct.begin(), vct.end());
    for(int i=0;i<n;i++)
        cout<<vct[i].second<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()



int main(void){

    int n;
    cin >> n;
    vector<int> d;
    rep(i,n){
        int a;
        cin >> a;
        d.push_back(a);
    }

    int ans = 0;

    sort(all(d));
    if(d[n/2]-d[n/2-1] > 0){
        ans = d[n/2]-d[n/2-1];    
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

ll gcd(ll a, ll b)
{
    if (!b)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

int main()
{
    start();
    int n, m;
    cin>>n>>m;
    char a[n][m];
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    for (int i=0;i<=n+1;i++)
    {
        for (int j=0;j<=m+1;j++)
        {
            if (i==0||j==0||i==n+1||j==m+1)
            {
                cout<<"#";
            }
            else
            {
                cout<<a[i-1][j-1];
            }
        }
        cout<<"\n";
    }

    return 0;
}

Measured memory_bytes: 3652
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
char a[100005];int n,x,y;
int main(){
	scanf("%s",a+1);n=strlen(a+1);
	for (int i=1;i<=n;i++){
		if (a[i]=='C') x=1;
		if (a[i]=='F'&&x) y=1;
	}
	if (y) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	a := nextInt()
	b := nextInt()
	c := nextInt()
	d := nextInt()
	if abs(a-c) <= d {
		fmt.Println("Yes")
	} else if abs(a-b) <= d && abs(b-c) <= d {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){

  for(;;){
  int w,d;
  cin>>w>>d;
  if(!w) break;

  int a[25]={},b[25]={},r=0;

  for(int i=0;i<w;i++){
    int x;
    cin>>x;
    a[x]++;
  }

  for(int i=0;i<d;i++){
    int x;
    cin>>x;
    if(a[x]>0) a[x]--;
    b[x]++;
  }

  for(int i=0;i<25;i++) r+=(a[i]+b[i])*i;

  cout<<r<<endl;

  }

  return 0;

}



Measured memory_bytes: 2984