akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
        int N;
        int x[120];
        cin >> N;
        int sum=0;
        for(int i=0 ; i<N ; i++ ){
                cin >> x[i];
                sum+=x[i];
        }
        sum=sum/N;
        int prev=2000000000,sa=sum;
        bool sign=false;
        while(true){
                int count=0;
                for(int i=0 ; i<N ; i++ ){
                        count+=(x[i]-sum)*(x[i]-sum);
                }
                if(sign==false){
                        if(prev>count){
                                prev=count;
                                sum++;
                        }else{
                                sign=true;
                                sum=sa-1;
                        }
                }else{
                        if(prev>count){
                                prev=count;
                                sum--;
                        }else break;
                }
        }
        cout << prev<< endl;
        return 0;
}

Measured memory_bytes: 256
import heapq

n, m = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(n)]
ls.sort(key=lambda x: x[0])

q = []
res = 0
index = 0
for i in range(1, m + 1):
    while index < n and ls[index][0] <= i:
        heapq.heappush(q, -ls[index][1])
        index += 1
    if len(q) > 0:
        res += -heapq.heappop(q)
print(res)

Measured memory_bytes: 31924
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n;
  cin >> n;
  vector<int>t(n+1);
  vector<int>x(n+1);
  vector<int>y(n+1);
  for(int i = 1;i<n+1;i++){
  cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  int flag=0;
  int kyori = 0;
  int time = 0;
  for(int i = 1;i<n+1;i++){
    kyori = abs(x.at(i)-x.at(i-1))+abs(y.at(i)-y.at(i-1));
    time =  abs(t.at(i)-t.at(i-1));
    if(kyori > time){
      flag = 1;
      break;
    }
    if(kyori%2 != time%2){
      flag = 1;
      break;
    }
  }
  if(flag==1) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 1408
import itertools

N=input()
seq=list(map(int,input().split()))

lst=list(itertools.combinations(seq,3))

#求める組合わせの個数をansとする
ans=0

for i in range(len(lst)):
    if lst[i][0]!=lst[i][1]:
        if lst[i][0]!=lst[i][2]:
            if lst[i][1]!=lst[i][2]:
                if lst[i][0]+lst[i][1] > lst[i][2]:
                    if lst[i][1]+lst[i][2] > lst[i][0]:
                        if lst[i][0]+lst[i][2] > lst[i][1]:
                            ans = ans+1
print(ans)

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

int n, a[200009]; bool u[200009], v[200009], w[200009];

bool solve(int pos) {
	for (int i = 1; i <= n; i++) { v[i] = false; w[i] = false; }
	for (int i = 1; i <= n; i++) {
		if (a[i] <= pos) u[i] = true; else u[i] = false;
	}
	int s = 1000000007;
	for (int i = 2; i <= n; i++) {
		if (u[i] == true && u[i - 1] == true) {
			for (int j = s; j <= i; j++) v[j] = true;
			s = i - 1; v[i] = true; v[i - 1] = true;
		}
		if (u[i] == false && u[i - 1] == false) {
			w[i] = true; w[i - 1] = true;
			s = 1000000007;
		}
	}
	if (u[1] == false) w[1] = true;
	if (u[n] == false) w[n] = true;
	int target = n / 2 + 1;
	if (v[target] == true) return true;
	if (w[target] == true) return false;

	int L = -1; vector<pair<int, int>>G;
	for (int i = 1; i <= n; i++) {
		if (v[i] == true) {
			if (L == -1) continue;
			if (L <= target && target <= i) {
				if ((L + i) / 2 <= target) return true;
			}
			L = -1;
		}
		else if (w[i] == false) {
			if (L == -1) L = i;
		}
		else {
			if (L != -1) {
				G.push_back(make_pair(L, i - 1));
				L = -1;
			}
		}
	}
	if (L != -1) G.push_back(make_pair(L, n));
	int R = -1;
	for (int i = n; i >= 1; i--) {
		if (v[i] == true) {
			if (R == -1) continue;
			if (R >= target && target >= i) {
				if ((R + i) / 2 >= target) return true;
			}
			R = -1;
		}
		else if (w[i] == false) {
			if (R == -1) R = i;
		}
		else { R = -1; }
	}
	if (G.size() == 0) return false;
	if (G[0] == make_pair(1, n)) return true;
	return false;
}

int main() {
	cin >> n; n = n * 2 - 1;
	for (int i = 1; i <= n; i++) cin >> a[i];
	int LL = 1, RR = n + 1, MM, maxn = 1000000007;
	for (int j = 0; j < 20; j++) {
		MM = (LL + RR) / 2;
		bool a1 = solve(MM);
		if (a1 == true) { maxn = min(maxn, MM); RR = MM; }
		else { LL = MM; }
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 2068
D, N = [int(i) for i in input().split()]

number = 0

if D == 0:
    for i in range(N):
        number += 1
        if (number % 100 == 0):
            number += 1

elif D == 1:
    for i in range(N):
        number += 100
        
        if (number % 100**2) == 0:
            number += 100

else: ## in case D == 2
    for i in range(N):
        number += 100 ** 2
        
        if (number % 100**3) == 0:
            number += 100 ** 2


print(number)

Measured memory_bytes: 3064
a,b = map(int,input().split())
c = str(a)
d = str(b)
e = 0
f = 0
if int(c[0]) + int(c[1]) * 10 >= int(c[3]) * 10 + int(c[4]):
    e = a // 100
else:
    e = a // 100 + 1
if int(d[0]) + int(d[1])*10 <= int(d[3])*10 + int(d[4]):
    f = b // 100
else:
    f = b // 100 - 1
print(f-e+1)

Measured memory_bytes: 38256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 2019
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
signed main()
{
	fastio;
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	int n=s.length();
	int ans[n];
	int pref[n];
	for(int i=0;i<n;i++)
	{
		ans[i]=((s[i]-'0')*power(10,i))%2019;
	}
	pref[0]=ans[0];
	for(int i=1;i<n;i++)
		pref[i]=(pref[i-1]+ans[i])%mod;
	mii mp;
	int sum=0;
	for(int i=0;i<n;i++)
	{
		if(pref[i]==0)
			sum+=1;
		sum+=mp[pref[i]];
		mp[pref[i]]++;
	}
	cout<<sum<<endl;
}












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

#define ll long long
#define pb push_back
#define mp make_pair
#define fo(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;


int main() {
    
     string s;
     cin>>s;
     if(s=="ABC") cout<<"ARC"<<endl;
     else if(s=="ARC") cout<<"ABC"<<endl;

    return 0;
}




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

int main() {
  ll n,m,q;
  cin >> n >> m >> q;
  vector<vector<ll>> s(n,vector<ll>(n));
  for(ll i=0;i<m;i++) {
    ll l,r;
    cin >> l >> r;
    l--;
    r--;
    s[l][r]++;
  }
  for(ll i=0;i<n;i++) {
    for(ll j=0;j<n-1;j++) {
      s[i][j+1]+=s[i][j];
    }
  }
  for(ll i=0;i<n-1;i++) {
    for(ll j=0;j<n;j++) {
      s[i+1][j]+=s[i][j];
    }
  }
  vector<ll> out(q);
  for(ll i=0;i<q;i++) {
    ll l,r;
    cin >> l >> r;
    l--;
    r--;
    out[i]=s[r][r];
    if(l>0) {
      out[i]=out[i]-s[r][l-1]-s[l-1][r]+s[l-1][l-1];
    }
  }
  for(ll i=0;i<q;i++) {
    cout << out[i] << endl;
  }
}

Measured memory_bytes: 3712
#include<stack>
#include<algorithm>
#include<iostream>
using namespace std;

int main(){
	int a[10];
	stack<int> h;
	for(int i=0;i<10;++i){
		cin>>a[i];
	}
	sort(a,a+10);
	for(int i=0;i<10;++i){
		h.push(a[i]);
	}
	for(int i=0;i<3;++i){
		int ans=h.top();
		cout<<ans<<endl;
		h.pop();
	}
	return 0;
}

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

using namespace std;

int main()
{
	int summer_vacation_days;
	int summer_assignments;
	cin>>summer_vacation_days;
	cin>>summer_assignments;
	vector<int> days(summer_assignments);
	
	int sum = 0;
	for(int i =0;i<summer_assignments;i++){
		cin>>days[i];
		sum += days[i];
	}
	
	if (summer_vacation_days >= sum){
		cout<<summer_vacation_days - sum<<endl;
	} else {
		cout<<-1<<endl;
	}
	
	
	
	return 0;
}


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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;
using li=list<int>;
using lil=list<ll>;
using lis=list<string>;
using fli=forward_list<int>;
using fll=forward_list<ll>;
using fls=forward_list<string>;
using si=stack<int>;
using sl=stack<ll>;
using ss=stack<string>;
using qi=queue<int>;
using ql=queue<ll>;
using qs=queue<string>;
using pqi=priority_queue<int>;
using pql=priority_queue<ll>;
using pqs=priority_queue<string>;
using dqi=deque<int>;
using dql=deque<ll>;
using dqs=deque<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)
#define repr(i, n) for(int i = (n); i >= 0; i--)
#define repr2(i, a, n) for(int i = (n); i >= (a); i--)

template<typename T,typename U>
void Inparray(T &f,U n){for(int i=0;i<n;i++) cin>>f[i];}

template<typename T,typename U>
void Printarray(T f,U n){for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];}
template<typename T,typename U>
void Printarray2(T f,U n){for(int i=0;i<n;i++) cout<<f[i]<<endl;}
template<typename T,typename U,typename V>
void Printarray3(T f,U a,V b){
  rep(i,a){
    rep(j,b){
      cout<<f[i][j];
    }
    cout<<endl;
  }
}
template<typename T,typename U>
void Printarray4(T f,U n){
  rep(i,n){
    rep(j,n){
      cout<<f[i][j];
    }
    cout<<endl;
  }
}

void flagfunc(bool flag,string A,string B){flag ? cout<<A<<endl : cout<<B<<endl;}
void flag2func(bool flag){flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;}
void flag3func(bool flag){flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int a,b,c;cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c<<endl;
}


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

public class Main{



  public static OutputStream out=new BufferedOutputStream(System.out);
  static Scanner sc=new Scanner(System.in);
  static long MOD=1000000007l;
  static int INF=10000000;
  static int[] rr=new int[]{1, 0, -1, 0};                                 //rook row move
  static int[] rc=new int[]{0, 1, 0, -1};                                 //rook col move

  //nl-->neew line; //l-->line;  //arp-->array print;  //arpnl-->array print new line
  public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes()); }
  public static void l(Object o) throws IOException{out.write((o+"").getBytes());}
  public static void arp(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+" ").getBytes()); out.write(("\n").getBytes());}
  public static void arpnl(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+"\n").getBytes());}
  public static void scanl(long[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextLong();}
  public static void scani(int[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextInt();}
  public static void scan2D(int[][] a,int n,int m) {for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=sc.nextInt();}
  //static variables

  //


  public static void main(String[] args) throws IOException{
    long sttm=System.currentTimeMillis();
    long mod=1000000007l;

    // int k=sc.nextInt();
    int k=1;
    while(k-->0){
        solve();
    }

    out.flush();
  }

  public static void solve() throws IOException{
      int n=sc.nextInt();
      long ans=0;
      for(int i=1;i<n;i++){
          int alpha=(n-1)/i;
          ans+=alpha;
      }
      nl(ans);
  }

}

class Pair{
  int x; int y;
  Pair(int x,int y){
    this.x=x;
    this.y=y;
  }
}


Measured memory_bytes: 38616
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int dp[40005];
int a[1005],b[1005];
signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif

// -------------------------------------Code starts here---------------------------------------------------------------------     

   int h,n;
   cin>>h>>n;
   int a[n];
   int s=0;
   for(int i=0;i<n;i++)
   {
      cin>>a[i];
      s+=a[i];
   }
   if(s>=h)
   {
      cout<<"Yes";
   }
   else
   {
      cout<<"No";
   }
   

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

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

int main() {
 int N;
 cin >>N;
  vector<ll> X(N);
  for(int i = 0;i<N;i++){
    cin >> X[i];
  }
  vector<ll> H(N);
  H = X;
  sort(X.begin(),X.end());
  vector<ll> Y(N);
  Y = X;
  
  for(int i = 0;i<N;i++){
    if(H[i]<Y[N/2]) cout << Y[N/2] << endl;
    else cout << Y[N/2 -1] << endl;
  }
  
}

Measured memory_bytes: 7040
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max()/2;
const int MOD = 1e9+7;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

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

    int w,h;
    while(cin>>w>>h, w||h){
        vector<string> s(h);
        for(int i=0;i<h;i++) cin>>s[i];
        vector<vector<int>> dis(1000,vector<int>(1000,INF));
        for(int i=0;i<h*w;i++) dis[i][i]=0;
        vector<P> dirty;
        int sx,sy;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(s[i][j]=='x') continue;
                if(s[i][j]=='*') dirty.push_back(P(i,j));
                if(s[i][j]=='o'){
                    sx=i;sy=j;
                }

                for(int k=0;k<4;k++){
                    int nx=i+dx[k],ny=j+dy[k];
                    if(nx<0 || h<=nx || ny<0 || w<=ny) continue;
                    if(s[nx][ny]=='x') continue;
                    int st=i*w+j,gt=nx*w+ny;
                    dis[st][gt]=1;
                }
            }
        }
        for(int k=0;k<h*w;k++){
            for(int i=0;i<h*w;i++){
                for(int j=0;j<h*w;j++){
                    dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
                }
            }
        }
        int sz=dirty.size();
        ll res=INF;
        do{
            int sx2=sx,sy2=sy;
            ll tmp=0;
            for(int i=0;i<sz;i++){
                int nx=dirty[i].first,ny=dirty[i].second;
                tmp+=dis[sx2*w+sy2][nx*w+ny];
                sx2=nx;sy2=ny;
            }
            res=min(res,tmp);
        }while(next_permutation(dirty.begin(),dirty.end()));
        if(res>=INF) cout<<-1<<endl;
        else cout<<res<<endl;
    }
}


Measured memory_bytes: 6808
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Data.Array.Unboxed    (UArray, (!))
import qualified Data.Array.Unboxed    as A
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  n <- readLn
  as <- map readInt . BS.words <$> BS.getLine
  print $ solve n as

solve :: Int -> [Int] -> Int
solve n as = maximum . map sum $ windows 3 bs where
  bs = A.accumArray (+) 0 (0, 10^5) [(a, 1) | a <- as]

windows :: Int -> UArray Int Int -> [[Int]]
windows n as = map (\i -> slice i n as) is where
  is = [l .. h-n]
  (l, h) = A.bounds as

slice :: Int -> Int -> UArray Int Int -> [Int]
slice i n as = map (as !) [i .. i+n-1]

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++)
		if ((i>=1&&i<=9)||(i>=100&&i<=999)||(i>=10000&&i<=99999))
			cnt++;
	cout<<cnt;
	return 0;
}

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

void agc024a(ll a, ll b, ll c, ll k) {
  if (k % 2 == 1) {
    cout << b - a << '\n';
  }
  else {
    cout << a - b << '\n';
  }
  return;
}

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  agc024a(a, b, c, k);

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;


int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= 9;i++) {
		if (n<=i*100+i*10+i) {
			cout << i * 100 + i * 10 + i << endl;
			return 0;
		}
	}
}

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  while(true){
    C -= B;
    if(C <= 0){
      cout << "Yes" << endl;
      break;
    }
    A -= D;
    if(A <= 0){
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
	int n, k;
	int count = 0;

	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;
		if (h >= k) {
			count++;
		}
	}
	cout << count << endl;
	
	return 0;
}

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

#define int long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"

int32_t main()
{
	IOS;
	int a,b,c;
  	cin>>a>>b>>c;
  	if(a+b == c || b+c == a || a+c  == b)
      cout<<"Yes"<<endl;
  	else
      cout<<"No"<<endl;
	return 0;
}

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

using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const int N = 200005;
int p[N];

int find(int u) {
    return u == p[u] ? u : (p[u] = find(p[u]));
}

int zero[N], one[N], pp[N];

struct Comp {
    bool operator()(int i, int j) {
        return (ll)zero[i] * one[j] > (ll)one[i] * zero[j]
            || ((ll)zero[i] * one[j] == (ll)one[i] * zero[j] && i > j);
    }
};

set<int, Comp> s;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(cout.fixed);
    cout.precision(20);
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        cin >> pp[i];
    }
    for (int i = 1; i <= n; i++) {
        int v;
        cin >> v;
        zero[i] = v == 0;
        one[i] = v == 1;
        p[i] = i;
        if (i != 1) {
            s.insert(i);
        }
    }
    ll res = 0;
    while (!s.empty()) {
        int i = *s.begin();
        s.erase(s.begin());
        int j = find(pp[i]);
        s.erase(j);
        res += (ll)one[j] * zero[i];
        zero[j] += zero[i];
        one[j] += one[i];
        if (j != 1) {
            s.insert(j);
        }
        p[i] = j;
    }
    cout << res << "\n";
}


Measured memory_bytes: 12800
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int X, Y, Z;
int main() {
    while (cin >> X >> Y >> Z) {
        cout << (X - Z) / (Y + Z) << endl;
    }
}


















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

using namespace std;
typedef long long ll;
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; }
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  int h,w,k;cin>>h>>w>>k;
  char s[h+1][w+1];
  vector<P>z;

  rep(i,0,h){
    rep(j,0,w){
      cin>>s[i][j];
      if(s[i][j]=='#'){
        z.push_back(P(j,i));
      }
    }
  }

  int ans[h+1][w+1];
  rep(i,0,h)rep(j,0,w)ans[i][j]=0;

  rep(i,0,z.size()){
    int x=z[i].first,y=z[i].second;
    ans[y][x]=i+1;
  }

  int num=0;
  // bool e=false;
  rep(i,0,h){
    int count=0;
    if(ans[i][0]==0)num++;
    rep(j,0,w){
      if(ans[i][j]==0){
        count++;
        ans[i][j]=num;
      }else {
        num=ans[i][j];
      }
    }
    if(count==w){
      num--;
      rep(j,0,w)ans[i][j]=0;
    }
  }
  rep(i,0,h){
    rep(j,0,w){
      if(ans[i][j]==0){
        if(i-1<0)ans[i][j]=ans[i+1][j];
        else ans[i][j]=ans[i-1][j];
      }
    }
  }
  for(int i=h-1;i>=0;i--){
    for(int j=w-1;j>=0;j--){
      if(ans[i][j]==0){
        // if(i+1>=h)ans[i][j]=ans[i+1][j];
        // else ans[i-1][j]=ans[i][j];
        ans[i][j]=ans[i+1][j];
      }
    }
  }

  rep(i,0,h){
    rep(j,0,w){
      cout<<ans[i][j]<<" ";
    }
    cout<<endl;
  }


  return 0;
}


Measured memory_bytes: 2800
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long N, M;
    scan(N, M);
    auto G = new long[][](N);
    foreach (_; 0 .. M)
    {
        long a, b;
        scan(a, b);
        a--, b--;
        G[a] ~= b;
        G[b] ~= a;
    }
    DList!long Q;
    auto ans = new long[](N);
    ans[] = -1;
    ans[0] = 0;
    Q.insertBack(0);
    while (!Q.empty)
    {
        auto v = Q.front;
        Q.removeFront();
        foreach (w; G[v])
        {
            if (ans[w] == -1)
            {
                ans[w] = v;
                Q.insertBack(w);
            }
        }
    }
    bool b = ans.all!"a != -1";
    if (!b)
    {
        writeln("No");
        return;
    }
    writeln("Yes");
    foreach (a; ans[1 .. $])
    {
        writeln(a + 1);
    }
}


Measured memory_bytes: 26448
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>

using namespace std;

int main() {

	long long W, H, x, y;

	cin >> W >> H >> x >> y;

	if (x == W / 2.0 && y == H / 2.0) {
		cout << fixed << setprecision(15) << W*H / 2.0 << ' ' << 1 << endl;
	}
	else{
		cout << fixed << setprecision(15) << W*H / 2.0 << ' ' << 0 << endl;
	}
	
	cin >> x;

	return 0;
}


Measured memory_bytes: 256
m;f(r,n,i,t){if(n==1)return r>i&r<10;for(;i++<9&i<r;)t+=f(r-i,n-1,i,0);return t;}main(s){for(;scanf("%d%d",&m,&s),m;printf("%d\n",f(s,m,-1,0)));}

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

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e - a <= k) {
  	cout << "Yay!" << endl;
  }
  else {
  	cout << ":(" << endl;
  }
}

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

namespace AOJ_ICPC1 {

	struct MDate {
		const int DayPerMonth_Dai = 20;
		const int DayPerMonth_Shou = 19;
		const int MonthPerYear = 10;

		int y, m, d;
		public MDate(string[] strs) {
			y = int.Parse(strs[0]);
			m = int.Parse(strs[1]);
			d = int.Parse(strs[2]);
		}
		public void NextDay() {
			if (d == (isDai() ? DayPerMonth_Dai : DayPerMonth_Shou)) {
				d = 1;
				if (m == MonthPerYear) {
					m = 1;
					y++;
				}
				else {
					m++;
				}
			}
			else {
				d++;
			}
		}
		public bool IsMillenium() {
			return y == 1000 && m == 1 && d == 1;
		}
		
		private bool isDai() {
			if (y % 3 == 0) return true;
			else return m % 2 == 1;
		}
	}
	class Program {
		static void Main(string[] args) {
			int N = int.Parse(Console.ReadLine());
			for (int n = 0; n < N; n++) {
				MDate mdata = new MDate(Console.ReadLine().Split(' '));
				
				int count = 0;
				while (!mdata.IsMillenium()) {
					count++;
					mdata.NextDay();
				}

				Console.WriteLine(count);
			}

		}
	}
}

Measured memory_bytes: 5640
#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;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
ll n, m;
const ll M = pow(10,9)+7;

vector<ll> fac(1000001); //n!(mod M)
vector<ll> ifac(1000001); //k!^{M-2} (mod M)
ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
//conbination
ll comb(ll a, ll b){ //aCb(mod M)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
//素因数分解o√n
map<int, int> prime_factor(int n)
{
    map<int, int> res;
    for (int i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1)
        res[n] = 1;
   // for (int i = 2; i <= n; i++)
        //cout << res[i] << "\n";
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<1000000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M)
    }
    map<int,int> div=prime_factor(m);
    ll ans=1;
    for(auto i=div.begin();i!=div.end();i++){
        int key=i->first;
        int value=i->second;
        if(key!=1){
            ans*=comb(value+n-1,value);
            ans%=M;
        }
    }
    cout << ans << "\n";
}

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


int main(){

    int N, A[200000];
    cin >> N;
    for( int i = 0; i < N; i++ ) cin >> A[i];


    for( int i = 0; i < N; i++ ) A[i] -= i+1;

    sort( A, A+N );
    
    long sum = 0;
    int b = A[(N-1)/2];
    for( int i = 0; i < N; i++ ) sum += abs( A[i] - b );
    
    cout << sum << endl;

    return 0;

}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int n, l[100000], ans[100000];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> l[i];
	ans[0] = 0;
	ans[1] = abs(l[1] - l[0]);
	for (int i = 2; i < n; i++) {
		ans[i] = min(abs(l[i - 2] - l[i]) + ans[i - 2], abs(l[i - 1] - l[i]) + ans[i - 1]);
	}
	cout << ans[n - 1];

}

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

int main() {
	int L, R, d, answer;
	cin >> L;
	cin >> R;
	cin >> d;
	answer = 0;
		for (cin >> L; L <= R; L++) {
		if (L % d == 0){
		answer++;
}
}
cout << answer <<endl;
}


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

int main(){
  string s; cin >> s; int maximum=0, l=0;
  for(int i=0;i<s.size();i++){
    if(s[i] != 'A' && s[i] != 'T' && s[i] != 'G' && s[i] != 'C') {l=0; continue;}
    l++; maximum = max(maximum, l);
  }
  cout << maximum << endl;
  return 0;
}

Measured memory_bytes: 3588
class TemplateTree:
  def __init__(self, iterable):
    self.iter_size = self.get_size(iterable)
    self.size = self.iter_size * 2 - 1
    self.value = [None] * self.size
    for i, v in enumerate(iterable):
      self.value[self.iter_size + i - 1] = v
    self.set_value(0)
    self.range = [None] * self.size
    self.set_range(0, 0, self.iter_size - 1)
  
  def get_size(self, iterable):
    ret = 1
    x = len(iterable)
    while ret < x:
      ret *= 2
    return ret
  
  def set_range(self, x, left, right):
    self.range[x] = (left, right)
    if left != right:
      self.set_range(x * 2 + 1, left, (right + left) // 2)
      self.set_range(x * 2 + 2, (right + left) // 2 + 1, right)

  def set_value(self, x):
    if x >= self.iter_size - 1:return self.value[x]
    a = self.set_value(x * 2 + 1)
    b = self.set_value(x * 2 + 2)
    if a == None and b == None:
      self.value[x] = None
    elif a == None:
      self.value[x] = b
    elif b == None:
      self.value[x] = a
    else:
      self.value[x] = a + b
    return self.value[x]

  def update(self, i, x):
    target = self.iter_size + i - 1
    while target >= 0:
      self.value[target] += x
      target = (target - 1) // 2

  def query(self, x, left, right):
    x_left, x_right = self.range[x]
    if right < x_left or x_right < left:
      return 0
    if left <= x_left and x_right <= right:
      return self.value[x]

    return self.query(x * 2 + 1, left, right) + self.query(x * 2 + 2, left, right)

  def print_tree(self):
    print(self.value)
    print(self.range)

n, q = map(int, input().split())
tree = TemplateTree([0] * n)

for _ in range(q):
  c, x, y = map(int, input().split())
  if c == 0:
    tree.update(x - 1, y)
  else:
    print(tree.query(0, x - 1, y - 1))



Measured memory_bytes: 37884
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

#define REP(i, b, e) for(int i = b ; i < e ; i++)
#define rep(i, n) for(int i = 0 ; i < n ; i++)

const int MAX = 1500000;

int m, n;
vector<int> book;

bool check(int v){
  int width = 0, pos = 0;
  rep(i, n){
    if(book[i] > v) return false;
    if(width + book[i] <= v) width += book[i];
    else width = 0, pos++, i--;
  }
  return pos < m;
}
    
int main(){
  while(cin >> m >> n, m|n){
    book.resize(n);
    rep(i, n) cin >> book[i];
    
    int L = 0, R = MAX;
    int M;
    while(L+1 != R){
      M = (L+R) / 2;
      if(check(M)) R = M;
      else L = M;    
    }
    cout << R << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 1000000000;


        static int N, M;
        static int[] p, x, y;
        
        
        public static void Input()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            N = input[0];
            M = input[1];
            p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            x = new int[M];
            y = new int[M];
            for(var i = 0; i < M; i++)
            {
                var xy = Console.ReadLine().Split().Select(int.Parse).ToArray();
                x[i] = xy[0];
                y[i] = xy[1];
            }
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            var U = new UnionFind(N);
            for(var i = 0; i < M; i++)
            {
                U.Unite(x[i] - 1, y[i] - 1);
            }

            long ans = 0;
            for(var i = 0; i < N; i++)
            {
                if (U.SameRoot(p[i] - 1, i)) 
                {
                    ans++;
                }

            }
            Console.WriteLine(ans);

            //Console.Out.Flush();
        }

        
    }

    public class UnionFind
    {
        public int[] parent;
        public int[] rank;
        public UnionFind(int size)
        {
            parent = new int[size];
            rank = new int[size];
            for(var i = 0; i < size; i++)
            {
                parent[i] = i;
                rank[i] = 0;
            }
        }

        private int Root(int x)
        {
            return parent[x] == x ? x : parent[x] = Root(parent[x]);
        }

        public bool SameRoot(int x,int y)
        {
            return Root(x) == Root(y);
        }

        public void Unite(int x,int y)
        {
            x = Root(x);
            y = Root(y);
            if (x == y) { return; }

            if (rank[x] < rank[y])
            {
                parent[x] = y;
            }
            else
            {
                parent[y] = x;
                if (rank[x] == rank[y]) { rank[x]++; }
            }
        }

    }



}



Measured memory_bytes: 24888
//written by libra9z
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
using namespace std;
#define Debug(x) cerr << #x << " = " << x << endl
#define Debug22(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<endl;
#define Debug2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define Debug3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<")\n";
#define Debug_arr(v,n) for(int i=0;i<n;++i) cerr<<#v<<"["<<i<<"]"<<" = "<<v[i]<<endl;
#define SET(p,v) fill((__typeof(**p)*)p,(__typeof(**p)*)p+sizeof(p),v);
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define prl cerr << "called: " << __LINE__ << endl
#define all(s) s.begin(),s.end()
const int INF=1e9;
string s;
int bit;
int dp[1<<26];
int main()
{
	for (int i=1;i<1<<26;++i)
	{
		dp[i]=INF;
	}
	cin>>s;
	for (auto x:s)
	{
		bit^=1<<(x-'a');
		for (int i=0;i<26;++i)
		{
			dp[bit]=min(dp[bit],dp[bit^(1<<i)]+1);
		}
	}
	cout<<max(1,dp[bit])<<endl;
	return 0;
}

Measured memory_bytes: 262784
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <limits>

#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;
typedef long long int lli;

int main(void)
{
	int N; cin >> N;
	vector<lli> A(N), B(N);
	lli sum = 0;
	rep(i, 0, N)cin >> A[i];
	rep(i, 0, N)B[i]= A[i]-1-i;
	sort(B.begin(), B.end());
	lli b = B[N / 2];

	lli ans = 0;
	rep(i, 0, N)ans += abs(B[i] - b);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int K,X;
  cin>>K>>X;
  for (int i(X-K+1);i<X;i++){
    if (i<-1*1000000) break;
    cout << i << " ";
  }
  for (int i(X);i<K+X;i++){
    if (i>1000000) break;
    cout << i << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
typedef std::vector<pl> vpl;
const long double EPS = 1e-9;

#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c) 
#define rsort(a,n) sort(a,a+n,greater<>())

const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 200;

int main(void){
    ll x,y,z;

    in3(x,y,z);

    ll i = 0;
    while (x / (i * y + (i+1) * z) > 0){
        i ++;
        if (x / (i * y + (i+1) * z) == 0) prl(i - 1);
    }

    return 0;
}

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

using namespace std;

const int N = 1e5+5;
int pl[N],cnt[N];

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k,q;
    cin >> n >> k >> q;
    
    int t;
    for(int i=0;i<q;i++){
    	cin >> t;
    	cnt[t]++;
	}
	for(int i=1;i<=n;i++){
		pl[i] = k-(q-cnt[i]);
	}
	for(int i=1;i<=n;i++){
		if(pl[i]<=0) cout << "No" << "\n";
		else cout << "Yes" << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 1408
n  =int(input())
s = input()

cnt = 0

for a in range(10):
    s_index = s.find(str(a)) 
    if s_index == -1:
        continue##この先はやらない
    for b in range(10):
        t_index = s.find(str(b),s_index+1)
        if t_index==-1:
            continue
        for c in range(10):
            u_index = s.find(str(c),t_index+1)
            if u_index != -1:
                cnt+=1
                    
               
        
print(cnt)

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

int main()
{
	int n,k;cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)	cin>>a[i];
	int l=1,r=1e9;
	auto check = [&](int len,int k) {
		int req=0;
		for(int i=0;i<n;i++) {
			int factor = a[i]/len;
			req+= (factor - ((factor*len==a[i])?1:0));
		}
		return req<=k;
	};
	while(l<=r) {
		int mid=l+(r-l)/2;
		if(check(mid,k)) {
			r=mid-1;
		}else{
			l=mid+1;
		}
	}
	cout<<r+1<<"\n";
	return 0;
}


Measured memory_bytes: 4396
#include<stdio.h>

unsigned long func(unsigned long h, unsigned long l){
    unsigned long a = h%l;
    while(a != 0){
        h = l;
        l = a;
        a = h%l;
    }
    return l;
}

unsigned long sub_func(unsigned long x){
    unsigned long c = 0;
    if(x % 2 == 0){
        c++;
        while(x%2 == 0){
            x = x/2;
        }
    }
    for(unsigned long i=3; i*i<=x; i += 2){
        if(x%i == 0){
            c++;
            while(x%i == 0){
                x = x/i;
            }
        }
    }
    if(x>1){
        c++;
    }

    return c;
}

int main(){
    unsigned long a, b;
    scanf("%lu%lu", &a, &b);
    unsigned long h, l, g;
    if(a>b){
        h = a;
        l = b;
    }else{
        h = b;
        l = a;
    }
    g = func(h, l);
    printf("%lu", sub_func(g) + 1);

    return 0;
}

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

using namespace std;
typedef long long ll;

const int N = 21;
const int M = 1e9 + 7;

int mat[N][N];
int memo[N + 7][(1 << N) + 7];
int n; 

int solve(int i, int mask) {
    if(i == n) return 1;
    int & st = memo[i][mask];

    if(st == -1) {
        st = 0;
        for(int j = 0; j < n; j++) {
            if((mask >> j)&1) continue;
            if(mat[i][j] == 0) continue;
            st = (st + solve(i+1, mask | (1 << j)))%M;
        }
    }
    return st;
}

int main() {
    memset(memo, -1, sizeof memo);
    cin >> n;

    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cin >> mat[i][j];
        }
    }

    cout << solve(0, 0) << endl;
}

Measured memory_bytes: 229632
#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;
int n;
double fun(int ctr1,int ctr2,int ctr3)
{
    int i,j,k;
    double dp[ctr1+ctr2+ctr3+1][ctr2+ctr3+1][ctr3+1];
    for(k=0;k<=ctr3;k++)
    {
        for(j=0;j<=ctr2+ctr3-k;j++)
        {
            for(i=0;i<=ctr1+ctr2+ctr3-j;i++)
            {
                if(i==0 && j==0 && k==0) dp[i][j][k]=0;
                else
                {
                    dp[i][j][k]=0.0;
                    if(i) dp[i][j][k]+=((double(i))/(i+j+k))*dp[i-1][j][k];
                    if(j) dp[i][j][k]+=((double(j))/(i+j+k))*dp[i+1][j-1][k];
                    if(k) dp[i][j][k]+=((double(k))/(i+j+k))*dp[i][j+1][k-1];
                    dp[i][j][k]+=(double(n))/(i+j+k);
                }
            }
        }
    }
    return dp[ctr1][ctr2][ctr3];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int i,j;
    cin>>n;
    int ctr[4]={0,0,0,0};
    for(i=0;i<n;i++)
    {
        cin>>j;
        ctr[j]++;
    }
    cout<<fixed<<setprecision(12)<<fun(ctr[1],ctr[2],ctr[3]);
}


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

using namespace std;

#define ll long long int

ll o=1e9+7;

int main()
{
	ll a,b,c,d;
	cin >> a >> b;
	vector<string> v;
	string s;
	ll ve[a][b];
	for(ll j=0;j<a;j++)
	{
		cin >> s;
		v.push_back(s);
	
	}
	for(ll j=0;j<a;j++)
	{
		for(ll k=0;k<b;k++)
		{
			if(v[j][k]=='#')
			{
				ve[j][k]=0;
			}
		}
	
	}
	if(v[0][0]=='.')
	ve[0][0]=1;
	else
	ve[0][0]=0;
	for(ll j=1;j<b;j++)
	{
			if(v[0][j]!='#')
			{
				ve[0][j]=ve[0][j-1];
			}
	}
	for(ll j=1;j<a;j++)
	{
			if(v[j][0]!='#')
			{
				ve[j][0]=ve[j-1][0];
			}
	}
	for(ll j=1;j<b;j++)
	{
		for(ll k=1;k<a;k++)
		{
			if(v[k][j]!='#')
			ve[k][j]=ve[k-1][j]+ve[k][j-1];
			ve[k][j]=ve[k][j]%o;
		}
	}
	cout << ve[a-1][b-1];
}

Measured memory_bytes: 9088
package main

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

func main() {
	N, K := ReadInt(), ReadInt()
	as := ReadInts(N)
	sort.Ints(as)
	sum := Sum(as[:K]...)
	fmt.Println(sum)
}

func Sum(slice ...int) int {
	sum := 0
	for _, v := range slice {
		sum += v
	}
	return sum
}

func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }


Measured memory_bytes: 1844
import sys
from heapq import heappush, heappop, heapify

input = sys.stdin.readline

def main():
    INF = float('inf')
    N = int(input())
    dist = [INF] * N
    visited = [False] * N
    
    E = [[] for i in range(N)]
    V = None
    
    for i in range(N-1):
        u, v, w = map(int, input().split())
        E[u-1].append((v-1, w))
        E[v-1].append((u-1, w))
        
        if V is None: V = u-1
    
    q = E[V]
    heapify(q)
    dist[V] = 0
    visited[V] = True
    
    while q:
        v, w = heappop(q)
    
        if visited[v]: continue
    
        visited[v] = True
        dist[v] = w
        
        for u, c in E[v]:
            if visited[u] or dist[u] <= w+c: continue
            heappush(q, (u, w+c))
            
    for d in dist:
        if d % 2: print(0)
        else: print(1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 43668
A, B, C = list(map(int, input().split()))
ABC = [int(str(A)+str(B))+C, int(str(A)+str(C))+B, int(str(B)+str(A))+C, int(str(B)+str(C))+A, int(str(C)+str(A))+B, int(str(C)+str(A))+B]

print(max(ABC))



Measured memory_bytes: 3316