akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define size 300010
#define inf 1e9+9
#define ll long long
#define tp to[p]
#define il inline
#define rint register int
#define gc getchar()
#define rep(i,s,n) for (register int i=s;i<=n;i++)
#define sro_zyb_orz int main()

using namespace std;

il ll read()
{
	char c; ll x,f=1;
	for (c=gc;!isdigit(c);c=gc) if (c=='-') f=-1; x=c-'0';
	for (c=gc;isdigit(c);c=gc) x=x*10+c-'0'; return x*f;
}

int S,T,n,m,nxt[size],head[size],to[size],len[size],sta[size],num=1,q[size];
il void add(int x,int y,int z) {num++;to[num]=y;len[num]=z;nxt[num]=head[x];head[x]=num;}
il void create(int x,int y,int z) {add(x,y,z); add(y,x,0);}

bool bfs()
{
	memset(sta,-1,sizeof(sta));
	int f=0,r=0; q[++r]=S; sta[S]=0;
	while (f<r)
	{
		int x=q[++f]; 
		for (int p=head[x];p;p=nxt[p])
			if (len[p]&&sta[tp]==-1) sta[tp]=sta[x]+1,q[++r]=tp;	
	}
	if (~sta[T]) return 1; return 0;
}

int dfs(int x,int flow)
{
	if (x==T) return flow;	
	int used=0,now=0;
	for (int p=head[x];p;p=nxt[p])
		if (len[p]>0&&sta[tp]==sta[x]+1)
		{
			now=dfs(tp,min(len[p],flow-used));
			len[p]-=now,len[p^1]+=now; used+=now; if (used==flow) break;
		}
	if (!used) sta[x]=-1; return used; 
}

int dinic() {int ans=0; while (bfs()) ans+=dfs(S,inf);return ans;}

struct Po
{
	int x,y,f;
}p[2010],Q[2010];
 
bool cmp(Po x,Po y)
{
	return (x.y+x.x<y.y+y.x);
}
 
int main()
{
	n=read(); 
	rep(i,1,n) p[i].x=read(),p[i].y=read(),p[i].f=i;
	rep(i,1,n) Q[i].x=read(),Q[i].y=read(),Q[i].f=i+n;
	S=2*n+10,T=2*n+20; 
	rep(i,1,n)
		rep(j,1,n)
			if (p[i].x<Q[j].x&&p[i].y<Q[j].y) create(p[i].f,Q[j].f,1);
	rep(i,1,n) create(S,p[i].f,1);
	rep(i,1,n) create(Q[i].f,T,1);
	cout<<dinic()<<endl;
	return 0;
}


Measured memory_bytes: 5120
from scipy.sparse.csgraph import dijkstra


def make_graph(m, subset):
    matrix = [[0] * (m + 1) for _ in range(m + 1)]
    for k in subset:
        for s in range(k, m + 1):
            matrix[s][s % k] = 1
    return dijkstra(matrix)


def solve(n, aaa, bbb):
    for a, b in zip(aaa, bbb):
        if a < b:
            return -1
    m = max(aaa)
    subset = set(range(1, m + 1))
    sp = make_graph(m, subset)
    if any(sp[a, b] > 50 for a, b in zip(aaa, bbb)):
        return -1

    for k in range(m, 0, -1):
        subset.remove(k)
        sp = make_graph(m, subset)
        if any(sp[a, b] > 50 for a, b in zip(aaa, bbb)):
            subset.add(k)
    return sum(1 << k for k in subset)


n = int(input())
aaa = list(map(int, input().split()))
bbb = list(map(int, input().split()))
print(solve(n, aaa, bbb))


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

typedef long long LL;

const int N = 1e5 + 10;
const int M = 3e5 + 10;

int n, m, a[M];
LL F[M];

priority_queue<int, vector<int>, greater<int> > Q;
priority_queue<int> P;

int main(){
	while(~scanf("%d", &n)){
		m = n * 3;
		for(int i=1; i<=m; i++)	scanf("%d", a+i);
		while(!Q.empty())	Q.pop();
		LL sum = 0;
		for(int i=1; i<=n; i++){
			Q.push(a[i]);
			sum += a[i];
		}
		F[n] = sum;
		for(int i=n+1; i<=n+n; i++){
            Q.push(a[i]);
            sum += a[i];
            sum -= Q.top();
            Q.pop();
            F[i] = sum;
		}
		sum = 0;
		while(!P.empty())	P.pop();
		for(int i=m; i>n+n; i--){
			P.push(a[i]);
			sum += a[i];
		}
		LL ans = F[n*2] - sum;
		for(int i=n+n; i>n; i--){
			P.push(a[i]);
            sum += a[i];
			sum -= P.top();
			P.pop();
			ans = max(ans, F[i-1] - sum);
		}
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 3320
N = int(input())
P = [int(_) for _ in input().split()]

count = 0
for n in range(N - 1):
    if P[n] == n + 1:
        P[n] = P[n + 1]
        P[n + 1] = n + 1
        count += 1
if P[N - 1] == N:
    count += 1
print(count)

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

struct node{
    int c,a[20];
}p[20];

int ans[15],v[20];
ll ANS=1e10,sum;
int n,m,u,x;

void dfs(int cnt,int pre)
{
    if(cnt==u)
	{
        sum=0;
        fill(v,v+20,0);
        for(int j=0;j<cnt;j++)
		{
            for(int k=0;k<m;k++)
                v[k]+=p[ans[j]].a[k];
            sum+=p[ans[j]].c;
        }
        int flag=1;
        for(int j=0; j<m; j++) 
			if(v[j]<x) 
			{
				flag=0;
				break;
			}
        if(flag) 
			ANS=min(ANS,sum);
        return;
    }
    for(int j=0;j<=n;j++)
	{
        if(j>pre)
		{
            pre=j;
            ans[cnt]=pre;
            dfs(cnt+1,pre);
        }
    }
}

int main()
{
    cin >> n >> m >> x;
    for(int i=1;i<=n;i++)
	{
        cin >> p[i].c;
        for(int j=0;j<m;j++)
            cin >> p[i].a[j];
    }
    for(u=1;u<=n;u++)
	{
        dfs(0,0);
    }
    if(ANS==1e10) 
		puts("-1");
    else 
		cout << ANS;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>
long long ans=0,n,t=0;
struct aaa
{
    long long x,y,z;
}aa[1001],bb[1001];
bool jisuan(long long x,long long y)
{
    ans=std::abs(x-aa[1].x)+std::abs(y-aa[1].y)+aa[1].z;

    for(long long i=2;i<=n;i++)
    {
        long long k=std::abs(x-aa[i].x)+std::abs(y-aa[i].y)+aa[i].z;
        //if(x==0&&y==0)std::cout<<ans<<' '<<k<<std::endl;
        if(k!=ans)return 0;
    }

    for(int i=1;i<=t;i++)
    {
        long long k=std::abs(x-bb[i].x)+std::abs(y-bb[i].y);
        if(k<ans)return 0;
    }
    return 1;
}
int main()
{
    std::cin>>n;
    for(long long i=1;i<=n;i++)
    {
        std::cin>>aa[i].x>>aa[i].y>>aa[i].z;
    }

    if(n==1)
    {
        std::cout<<aa[1].x<<' '<<aa[1].y<<' '<<aa[1].z<<std::endl;
        return 0;
    }
    for(int i=1;i<=n;i++)
    {
        if(aa[i].z==0)
        {
            bb[++t]=aa[i];
            for(int j=i;j<n;j++)aa[j]=aa[j+1];
            n--;
            i--;
        }
    }
    for(long long i=0;i<=100;i++)
    {
        for(long long j=0;j<=100;j++)
        {
            if(jisuan(i,j))
            {
                std::cout<<i<<' '<<j<<' '<<ans<<std::endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

// #define amari(x) ((x) % 1000000007)
#define amari(x) ((x) % 998244353)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(long i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

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

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

  long n;
  cin >> n;

  vector<long> a(n);
  fillLong(a, n);

  
  long all = gcd(a[0], a[1]);
  set<long> v;
  v.insert(a[0]);
  v.insert(a[1]);

  for (long i = 2; i < n; i++) {
        set<long> v2;
v2.insert(all);
    all = gcd(all, a[i]);

    for (long vv: v) {
      v2.insert(gcd(vv, a[i]));
    }

    v = v2;
  }

  cout << *max_element(v.begin(), v.end()) << endl;

  return 0;
}


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

int main(){ 
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  bool ok = true;
  for (int i = 0; i < n; i++) {
    if (a[i] & 1) continue;
    if (a[i] % 3 != 0 && a[i] % 5 != 0) ok = false; 
  }
  if (ok) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
  return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,A[200001];
    cin>>n;
    rep(i,n) cin>>A[i];
    int x=0,y=0,z=0;
    rep(i,n){
        if(y==0) x++;
        else x=1;
        if(i<n-1&&A[i]>=A[i+1]) y=0;
        else y=1;
        z=max(x,z);
    }
    cout<<z-1;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
    static int N;
    static int A;
    static int[] x;
    static long count;
    static int sum;
    static int max;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        N = sc.nextInt();
        A = sc.nextInt();
        x = new int[N];
        max = A;
        for(int i = 0;i < N; i++){
            x[i] = sc.nextInt();
            max = Math.max(max, x[i]);
            x[i] -= A;
        }
        sc.close();
        long[][] dp = new long[N+1][2*N*max+1];
        for(int i = 0; i < N+1; i++){
            for(int j = 0; j < dp[i].length; j++){
                if(i == 0){
                    if(j == N*max)
                        dp[i][j] = 1;
                    else
                        dp[i][j] = 0;
                } else {
                    if(j-x[i-1] < 0 || j-x[i-1] > 2*N*max)
                        dp[i][j] = dp[i-1][j];
                    else
                        dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i-1]];
                }
            }
        }
        System.out.println(dp[N][N*max]-1);
    }
}

Measured memory_bytes: 22736
//  Created by conan1024hao on 2019/11/24.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------
const int MAX_N=1<<17;
ll n,data[4*MAX_N];
void init(ll n1){
    n=1;
    while(n<n1)
        n*=2;
    for(int i=0;i<2*n-1;i++)
        data[i]=2147483647;
}
void update(ll k,ll a){
    k+=n-1;
    data[k]=a;
    while(k>0){
        k=(k-1)/2;
        data[k]=std::min(data[k*2+1],data[k*2+2]);
    }
}
ll query(ll a,ll b,ll k,ll l, ll r){
    if(r<=a||b<=l)
        return 2147483647;
    if(a<=l&&b>=r)
        return data[k];
    else{
        ll vl=query(a,b,k*2+1,l,(l+r)/2);
        ll vr=query(a,b,k*2+2,(l+r)/2,r);
        return min(vl,vr);
    }
}
//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //------------------------------
    ll nn,q;
    cin>>nn>>q;
    init(nn);
    while(q--){
        ll com,x,y;
        cin>>com>>x>>y;
        if(com==0)
            update(x,y);
        else
            cout<<query(x, y+1, 0, 0, n)<<endl;
    }
    //for(int i=0;i<n;i++)
     //   cout<<data[i]<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 5216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())


int main() {
  int N;
  cin >> N;
  vi L(N);
  rep(i,N) {
    cin >> L[i];
  }
  sort(all(L));
  int ans = 0;
  rep(i,N) {
    reps(j,i+1,N) {
      if (L[i] == L[j])
        continue;
      reps(k,j+1,N) {
        if (L[j] == L[k])
          continue;
        if (L[k] < L[i]+L[j])
          ans++;
      }
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 3568
n,a,b=map(int,input().split())
mod=10**9+7
bunbo=1
bunshi=1
for i in range(1,max(a+1, b+1)):
    bunbo*=i
    bunshi*=n-i+1
    bunshi%=mod
    bunbo%=mod
    if i==a:
        comba=bunshi*(pow(bunbo,mod-2,mod))
    if i==b:
        combb=bunshi*(pow(bunbo,mod-2,mod))
print((2**n-1-comba-combb)%mod)

Measured memory_bytes: 281524
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
using namespace std;

typedef long long lint;

int main(){
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100;
    b *= 100;
    int asum = 0, asugar = 0;
    for(int i = 0 ; i <= f / a ; i++){
        for(int j = 0 ; j <= (f - a * i) / b ; j++){
            int water = a * i + j * b;
            if(water == 0){
                continue;
            }
            for(int k = 0 ; k <= (f - water) / c ; k++){
                for(int l = 0 ; l <= (f - water - k * c) / d ; l++){
                    int sugar = k * c + l * d;
                    if(e * (water + sugar) >= sugar * (100 + e)){
                        if(sugar * asum >= (water + sugar) * asugar){
                            asum = water + sugar;
                            asugar = sugar;
                        }
                    }
                }
            }
        }
    }
    cout << asum << " " << asugar << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

const ll MOD = 1e9+7;

int main(){
    ll n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    string ans = "";
    rep(i,0,n){
        ans += s[i];
        ans += t[i];
    }

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


Measured memory_bytes: 3652
import System.IO
import Control.Applicative ((<$>))

axtif :: Int -> Int -> Int -> [Int] -> Int
axtif _ _ c [] = c
axtif b m c (x:xs) | b > x = axtif x m c xs
                   | b < x && m < x - b = axtif b (x-b) 1 xs
                   | b < x && m == x - b = axtif b m (c+1) xs
                   | otherwise = axtif b m c xs

main = do
  s1 <- getLine
  let (num:lim:_) = (\x -> read x :: Int) <$> words s1
  s2 <- getLine
  let towns = read <$> words s2
  (putStrLn . show) $ axtif (head towns) 0 0 (tail towns)

Measured memory_bytes: 36220
package main

import "fmt"

func main() {
	var h int
	var m int
	var s int
	fmt.Scan(&s)
	h = s / 3600
	m = (s % 3600) / 60
	s = (s % 3600) % 60
	fmt.Print(h)
	fmt.Print(":")
	fmt.Print(m)
	fmt.Print(":")
	fmt.Println(s)

}



Measured memory_bytes: 1164
#include<stdio.h>

int main(){
	int x, y;
	while(1){
		scanf("%d %d", &x, &y);
		if (x==0 && y==0){
			break;
		}
		
		if(x < y){
			printf("%d %d", x, y);
		} else if (x > y){
			printf("%d %d", y, x);
		} else if (x==y){
			printf("%d %d", x, y);
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;

int main()
{

    int a,b;
    cin >> a >> b;
    int tableau[a][b];
    for(int i = 0; i < a; i++)
    {
        for(int j = 0; j < b; j++)
        {
            char p;
            cin >> p;
            if(p == '.')
            {
                tableau[i][j] = 0;
            }
            else
            {
                tableau[i][j] = 1;
            }
        }
    }
    bool foo = true;
    for(int i = 0; i < a && foo; i++)
    {
        for(int j = 0; j < b && foo; j++)
        {
            if(tableau[i][j] == 1)
            {
                bool istrue = false;
                if( i > 0)
                {
                    if(tableau[i-1][j] == 1)
                    {
                        istrue = true;
                    }
                }
                if( i < a-1)
                {
                    if(tableau[i+1][j] == 1)
                    {
                        istrue = true;
                    }
                }
                if( j > 0)
                {
                    if(tableau[i][j-1] == 1)
                    {
                        istrue = true;
                    }
                }
                if( j < b-1)
                {
                    if(tableau[i][j+1] == 1)
                    {
                        istrue = true;
                    }
                }
                foo = istrue;
            }
        }
    }
    if(foo)
    {
        cout << "Yes" << "\n";
    }
    else
    {
        cout << "No" << "\n";
    }
}


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


void solve(long long N){
    double a;
    if (N == 1) {
        a = 1.0;
    } else if (N % 2 == 0) {
        a = 0.5;
    } else {
        a = (double)(N/2 + 1) / N;
    }
    printf("%.10lf\n", a);
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
/*
	Auth: Loxilante
	Time: 2020/09/26
	Prog: ACBL-C
	Lang: cpp
*/
#include <bits/extc++.h>
#define rep(i, l, r) for(int i = l; i < r; i++)
#define hrp(i, l, r) for(int i = l; i <= r; i++)
#define rev(i, r, l) for(int i = r; i >= l; i--)
#define ms(n, t) memset(n, t, sizeof(n))
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...) 97
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn = int> inline tn next(void) { tn k; cin>>k; return k; }
const int U = 1e5+50;
int father[U];
inline int find(const int& k)
{
	if (father[k] == k) return k;
	return father[k] = find(father[k]);
}
inline void merge(const int &a, const int& b)
{
	father[find(a)] = find(b);
}
inline bool ask(const int& a, const int& b)
{
	return find(a) == find(b);
}
set<int> st;
signed main(void)
{
	clock_t Begin = clock();

	#ifdef JOEON
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	
	ios::sync_with_stdio(false);
	cin.tie(0);

	hrp(i, 0, 1e5) father[i] = i;
	
	int n, m;
	cin>>n>>m;
	rep(i, 0, m)
	{
		int from, to;
		cin>>from>>to;
		merge(from, to);
	}
	hrp(i, 1, n) st.insert(find(i));
	D(st);
	cout<<st.size()-1<<endl;
	
	clock_t InputFinished = clock();
	
	
	
	clock_t End = clock();
	
	D((double)(End-Begin)/CLOCKS_PER_SEC);
	D((double)(End-InputFinished)/CLOCKS_PER_SEC);
	
	return 0;
}
/*

 */

Measured memory_bytes: 8460
#include<bits/stdc++.h>
#define lint long long
#define st first
#define nd second
#define INF 0x3f3f3f3f

using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int a, b;
	cin>>a>>b;
	if(a <= 8 && b<=8)
		cout<<"Yay!\n";
		
	else cout<<":(\n";
	return 0;	
}


Measured memory_bytes: 3592
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<sstream>
#include<cmath>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
const int MAX = 510000;
const int MOD = 1000000007;
const int inf = 1<<31-1;
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; }
int main(void) {
    string s; int k; cin >> s >> k;
    int dp[110][2][4],n = s.size();
    Fill(dp, 0);
    dp[0][0][0] = 1;
    rep(i, n) {
        int nm = s[i] - '0';
        rep(j, 2) {
            rep(l, 4) {
                rep(d, 10) {
                    int nl = l, nj = j;
                    if (d != 0)nl++;
                    if (nl > k)continue;
                    if (nj == 0) {
                        if (nm < d)continue;
                        if (nm > d) nj = 1;
                    }dp[i + 1][nj][nl] += dp[i][j][l];
                }
            }
        }
    }cout << dp[n][0][k] + dp[n][1][k] << endl;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define DEC(x) fixed<<setprecision(x)
#define FAST ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);
const long long INF=2e18;

template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;}

ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll modinv(ll a,ll m)
{
    return power(a,m-2,m);
}

// #define _NCR_
const ll int N=300005;
ll cr[N],cc[N];
set<pll>s;
set<ll>sr,sc;
// vector<vector<ll>>vr,vc;
int TLE_TERROR()
{
 	ll int h,w,m,l,r,mr=1,mc=1,ans,z,y;
 	cin>>h>>w>>m;
 	for(ll int i=0;i<m;i++)
 	{
 		cin>>l>>r;
 		cr[l]++;
 		cc[r]++;
 		s.insert({l,r});
 		mr=max(mr,cr[l]);
 		mc=max(mc,cc[r]);
 	}
 	ans=mr+mc;
 	// cout<<ans<<endl;
 	for(ll int i=1;i<=h;i++)
 	{
 		if(cr[i]==mr)
 		{
 			sr.insert(i);
 		}
 	}
 	for(ll int i=1;i<=w;i++)
 	{
 		if(cc[i]==mc)
 		{
 			sc.insert(i);
 		}
 	}
 	for(auto it=sr.begin();it!=sr.end();it++)
 	{
 		for(auto itr=sc.begin();itr!=sc.end();itr++)
 		{
 			z=(*it);
 			y=(*itr);
 			if(!s.count({z,y}))
 			{
 				cout<<ans;
 				return 0;
 			}
 		}
 	}
 	ans-=1;
 	cout<<ans;

 	return 0;   
}

int main()
{
    FAST
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll int TESTS=1;
    // cin>>TESTS;
    #ifdef _NCR_
        initialvalues();
    #endif
    while(TESTS--)
        TLE_TERROR();
    return 0;
}

Measured memory_bytes: 55132
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  ll ans=INF;

  ll aa=a/3;
  vector<ll> p={aa*b,(a-aa)/2*b,(a-aa-(a-aa)/2)*b};
  sort(all(p));
  chmin(ans,p[2]-p[0]);

  p={aa*b,(a-aa)*(b/2),(a-aa)*(b-b/2)};
  sort(all(p));
  chmin(ans,p[2]-p[0]);

  aa++;
  p={aa*b,(a-aa)/2*b,(a-aa-(a-aa)/2)*b};
  sort(all(p));
  chmin(ans,p[2]-p[0]);

  p={aa*b,(a-aa)*(b/2),(a-aa)*(b-b/2)};
  sort(all(p));
  chmin(ans,p[2]-p[0]);


  ll bb=b/3;
  p={bb*a,(b-bb)/2*a,(b-bb-(b-bb)/2)*a};
  sort(all(p));
  chmin(ans,p[2]-p[0]);

  p={bb*a,(b-bb)*(a/2),(b-bb)*(a-a/2)};
  sort(all(p));
  chmin(ans,p[2]-p[0]);

  bb++;
  p={bb*a,(b-bb)/2*a,(b-bb-(b-bb)/2)*a};
  sort(all(p));
  chmin(ans,p[2]-p[0]);

  p={bb*a,(b-bb)*(a/2),(b-bb)*(a-a/2)};
  sort(all(p));
  chmin(ans,p[2]-p[0]);

  cout << ans << endl;
}

Measured memory_bytes: 256
#define sp ' '
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
	int a,b,i,ans,max;
	cin >> a;
  	ans=0;
  max=0;
  for(i=1;i<=a;i++){
    cin >>b;
    if(max-b>1){
      ans=-1;
    }
	if(b>=max){
      max=b;
    }  
  }
    if(ans==0){
      cout << "Yes";
    }
  else{
    cout << "No";
  }
	return 0;
}

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

typedef pair<int,int> P;
const int INF = (1<<29);

struct edge{int to, cap, cost, rev;};
 
int V;
vector<edge> G[300];
int h[300];
int dist[300];
int prevv[300],preve[300];
  
void init(){
  for(int i = 0 ; i < 300 ; i++){
    G[i].clear();
  }
}
  
void add_edge(int from,int to,int cap,int cost){
  G[from].push_back((edge){to, cap, cost, G[to].size()});
  G[to].push_back((edge){from, 0, -cost, G[from].size() - 1});
}
  
int min_cost_flow(int s,int t,int f){
  int res = 0;
  fill(h,h+V,0);
  while(f > 0){
    priority_queue<P,vector<P>,greater<P> > que;
    fill(dist,dist + V,INF);
    dist[s] = 0;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      int v = p.second;
  
      if(dist[v] < p.first)continue;
      for(int i = 0 ; i < (int)G[v].size() ; i++){
        edge &e = G[v][i];
          
        if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]){
          dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
          prevv[e.to] = v;
          preve[e.to] = i;
          que.push(P(dist[e.to],e.to));
        }
      }
    }
  
    if(dist[t] == INF){
      return -1;
    }
  
    for(int v = 0 ; v < V ; v++) h[v] += dist[v];
        
    int d = f;
  
    for(int v = t; v != s; v = prevv[v]){
      d = min(d,G[prevv[v]][preve[v]].cap);
    }
    f -= d;
    res += d * h[t];
    for(int v = t ; v != s ; v = prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  return res;
}
 
struct result{
  int x,y;
  string s;
};

int N;
int W[111][111];
int E[111][111];
char M[111][111];

int cost[111][111];

vector<result> ans;
void writer(int x,int y){
  for(int k=0;k<N;k++){
    if( x == k ){
      if( M[k][y] == '.' )
	ans.push_back( (result){k,y,"write"} );      
    } else
      if( M[k][y] == 'o' )
	ans.push_back( (result){k,y,"erase"} );
  }
}
 
int main(){
  cin >> N;
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++) cin >> W[j][i];
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++) cin >> E[j][i];
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++) cin >> M[j][i];
  
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      for(int k=0;k<N;k++){
	if( j == k ){
	  if( M[k][i] == '.' ) cost[j][i] += W[k][i];
	} else
	  if( M[k][i] == 'o' ) cost[j][i] += E[k][i];
      }
    }
  }

  for(int x=0;x<N;x++)
    for(int y=0;y<N;y++)
      add_edge(x,y+N,1,cost[x][y]);

  for(int i=N;i<N+N;i++)
    add_edge(i,N+N+1,1,0);
  for(int i=0;i<N;i++)
    add_edge(N+N,i,1,0);

  V = N + N + 2;

  cout << min_cost_flow(N+N,N+N+1,N) << endl;
  
  for(int i=0;i<N;i++){
    for(int j=0;j<(int)G[i].size();j++){
      if( N <= G[i][j].to && G[i][j].to < N+N )
	if( G[i][j].cap == 0 )
	  writer(i,G[i][j].to-N);
    }
  }

  cout << ans.size() << endl;
  for(int i=0;i<(int)ans.size();i++){
    cout << ans[i].y+1 << " " << ans[i].x+1 <<" " << ans[i].s<< endl;
  }
  
}

Measured memory_bytes: 1940
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        if(a.equals(b)){
        	System.out.println("H");
        }else{
        	System.out.println("D");
        }
    }
}

Measured memory_bytes: 35588
process.stdin.resume();
process.stdin.setEncoding('ascii');

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on('data', function (data) {
    input_stdin += data;
});

process.on('SIGINT', function(){
    input_stdin_array = input_stdin.split("\n");
    main();
    process.exit();
});

process.stdin.on('end', function () {
    input_stdin_array = input_stdin.split("\n");
    main();    
});

function readLine() {
    return input_stdin_array[input_currentline++];
}

/////////////// ignore above this line ////////////////////

function main() {
	var s = readLine(); s = s.split(" ");
	var H = parseInt(s[0]), W = parseInt(s[1]);
	var C = [];
	
	for (var i=0; i < H; i++){
		s = readLine();
		C.push(s);
	}
	
	for (var i=0; i < H; i++){
		console.log(C[i]);
		console.log(C[i]);
	}
}


Measured memory_bytes: 9020
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#define so(v) sort(v.begin(),v.end())
using ll = long long;
using vi=vector<int>;
using vii=vector<vi>;
const int MAX = 510000;
const int MOD = 1000000007;
ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
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() {
  int n,k,sum=0;cin>>n>>k;
  rep(i,k){
      int l;cin>>l;sum+=l;
  }
  if(n<=sum)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(10) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<lli,lli>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  double A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> A >> B >> X;
  double ans;
  double pi=acos(-1);
  if(A*A*B/2<X){
    N=A*B-X/A;
    ans=atan2(2*N/A,A);
  }else{
    N=X/A;
    ans=atan2(B,2*N/B);
  }
  HpOut(ans*180.0/pi);
}

Measured memory_bytes: 256
import sys

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

class BitSum:
    def __init__(self, n):
        self.n = n + 3
        self.table = [0] * (self.n + 1)

    def add(self, i, x):
        i += 1
        while i <= self.n:
            self.table[i] += x
            i += i & -i

    def sum(self, i):
        i += 1
        res = 0
        while i > 0:
            res += self.table[i]
            i -= i & -i
        return res

def main():
    n = II()
    bits = [BitSum(n) for _ in range(26)]
    s = list(SI())
    a = ord("a")
    for i, c in enumerate(s):
        code = ord(c) - a
        bits[code].add(i, 1)
    q = II()
    for _ in range(q):
        op, x, y = input().split()
        if op == "1":
            i = int(x) - 1
            now = s[i]
            s[i] = y
            bits[ord(now) - a].add(i, -1)
            bits[ord(y) - a].add(i, 1)
        else:
            l, r = int(x) - 2, int(y) - 1
            print(sum(bits[i].sum(r) - bits[i].sum(l) > 0 for i in range(26)))

main()


Measured memory_bytes: 172164
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	string S;
	cin >> S;

	for (char c = 'a'; c <= 'z'; c++) {
		if (S.find(c) == string::npos) {
			cout << c;
			return 0;
		}
	}
	cout << "None";

	return 0;
}

Measured memory_bytes: 512
N,W = map(int,input().split())
wvs = [[int(kk) for kk in input().split()] for i in range(N)]

dp = [0]*(W+1)

for w,v in  wvs:
    for i in reversed(range(W+1)):
        #print(i)
        dp[i] = max(dp[i-w]+v,dp[i])
        if i == w:
            break

print(max(dp))



Measured memory_bytes: 41708
#include <iostream>
#include <cmath>

using namespace std;

double pre_distance(int x1, int x2){
    return pow(abs(x1-x2), 2);
}

int main(){
    int n, d;
    cin >> n >> d;
    int x[n][d];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin >> x[i][j];
        }
    }
    int cnt = 0;
    for(int i = 0; i < n; i++){
        double distance = 0;
        if(i != n - 1){
            for(int k = 1; k < n - i; k++){
                double distance = 0;
                for(int j = 0; j < d; j++){
                    distance += pre_distance(x[i][j], x[i+k][j]);
                }
                distance = pow(distance, 0.5);
                if(ceil(distance) == floor(distance)) cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
//const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main(){
    int n; cin >> n;
    
    map<int,int> ai, ja;
    reps(i,1,n){
        int a; cin >> a;
        ai[a + i]++;
        ja[i - a]++;
    }
    
    int ans = 0;
    for(auto [a, c] : ai){
        ans += c * ja[a];
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 37828
from functools import lru_cache

@lru_cache(maxsize=None)
def Fib(n) :
    if n == 0 :
        return 1
    elif n == 1 :
        return 1
    else :
        return Fib(n-1) + Fib(n-2)

N = int(input())
print(Fib(N))


Measured memory_bytes: 6292
a, b = gets.split.map(&:to_i)
s = gets.chomp

ok = true
(a+b+1).times do |i|
  if i == a
    ok &= s[i] == '-'
  else
    ok &= s[i] =~ /[0-9]/
  end
end

puts ok ? "Yes" : "No"


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  int x; cin>>x;
  cout<<(x<1200?"ABC":"ARC")<<endl;
}













Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int h, n;
  	scanf("%d %d", &h, &n);
  	int sum = 0, a;
  	while(n-- > 0){
    	scanf("%d", &a);
      	sum += a;
    }
  	puts(sum >= h ? "Yes" : "No");
}

Measured memory_bytes: 128
#include <stdio.h>

int main()
{   int H,N,sum;
    scanf("%d%d",&H,&N);
    int arr[N];
    for(int i=0;i<N;i++)
    {
        scanf("%d",&arr[i]);
        sum+=arr[i];
    }
    if(sum>=H)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }

    return 0;
}


Measured memory_bytes: 2536
#include <stdio.h>

/******
*	??°?????????
******/

int main(void)
{
	char number[1001]={0};		//?????????????????????
	int i;
	int num, sum;
	
	while(1){
		sum = 0 ;				//????¨?????????????
		num = 0 ;				//??°????????????
		scanf("%s", number);	//???????????\???
		if(number[0] == '0'){	//??\?????????????????????0?????¨?????????
			break;
		}
		else {
//			printf("%c",&number[0]);
			for ( i = 0 ; i <= 1000 ; i++){	//????´???°i??§?????????
				if(number[i] != '\0' ){
					num = number[i] - '0';		//??????????????°??????
					sum += num;					//??°???????¶?????????????
				}else {
					break;
				}
			}
			printf("%d\n", sum);		//????¨?????????????
		}
	}
}

Measured memory_bytes: 964
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd${0:#:TARGET}

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

    int2(h, w);
    int2(a, b);

    cout << (h * w) - (a * b) * (h / a) * (w / b) << endl;

    return 0;
}



Measured memory_bytes: 3184
def resolve():
    x, k, d = map(int, input().split())
    x = abs(x)
    if x // d > k:  # 最大長が0まで届くか
        print(x - k * d)
    elif (k - x // d) % 2 == 0:  # 0を反復横跳びする     偶数->X側、奇数->-X側
        print(x % d)
    else:
        print(d - x % d)
        
resolve()

Measured memory_bytes: 61924
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>

using namespace std;
typedef long long Int;
typedef pair<Int, Int> P;

vector<P> edge[2][5250];
Int c[5250], r[5250];
bool come[5250];
Int dist[5250];
void bfs(int x){
    queue<int> q;
    fill(come, come + 5250, false);
    q.push(x);
    for(int i = 0;!q.empty() && i <= r[x];i++){
	for(int j = q.size() - 1;j >= 0;j--){
	    int tmp = q.front();q.pop();
	    if(come[tmp])continue;
	    come[tmp] = true;
	    edge[0][x].push_back(P(tmp, c[x]));
	    for(int k = 0;k < edge[1][tmp].size();k++){
		q.push(edge[1][tmp][k].first);
	    }
	}
    }
}

void dijkstra(int start){
    priority_queue<P, vector<P>, greater<P> > pq;
    fill(dist, dist + 5250, 1LL << 60);
    dist[start] = 0;
    pq.push(P(0, start));
    while(!pq.empty()){
	P tmp = pq.top();pq.pop();
	int from = tmp.second;
	Int cost = tmp.first;
	if(dist[from] < cost)continue;
	for(int i = 0;i < edge[0][from].size();i++){
	    int to = edge[0][from][i].first;
	    Int cc = edge[0][from][i].second;
	    if(dist[from] + cc < dist[to]){
		dist[to] = dist[from] + cc;
		pq.push(P(dist[to], to));
	    }
	}
    }
}

int main(){
    int n, k, a, b;
    cin >> n >> k;
    for(int i = 0;i < n;i++){
	cin >> c[i] >> r[i];
    }
    for(int i = 0;i < k;i++){
	cin >> a >> b;
	a--, b--;
	edge[1][a].push_back(P(b,0));
	edge[1][b].push_back(P(a,0));
    }
    for(int i = 0;i < n;i++){
	bfs(i);
    }
    dijkstra(0);
    cout << dist[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 235940
#include <bits/stdc++.h>
using namespace std;
int main()
  {
int a,b,c;
  cin >>a >>b >>c;
  if (a>=b && a>=c)cout<<10*a+b+c<<endl;
  else if (a<=b && b>=c)cout<<10*b+c+a<<endl;
  else cout<<10*c+b+a<<endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = sum(a)

for i in range(n):
    if b[i] > a[i]:
        b[i] -= a[i]
        a[i] = 0
        if b[i] >= a[i+1]:
            a[i+1] = 0
        else:
            a[i+1] -= b[i]
    else:
        a[i] -= b[i]

print(c - sum(a))

Measured memory_bytes: 24068
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,M;cin >> N >> M;
  priority_queue<ll> pque;
  rep(i,N){
    ll x;cin >> x;
    pque.push(x);
  }
  rep(i,M){
    ll x = pque.top();
    pque.pop();
    x/=2;
    pque.push(x);
  }
  ll sum = 0;
  while(!pque.empty()){
    sum += pque.top();
    pque.pop();
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int a[200010];
    rep(i, N) cin >> a[i];
    int ans = N;
    int search = 1;
    rep(i, N) {
        if(a[i] == search) {
            ans--;
            search++;
        }
    }
    if(ans == N) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 4380
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;

ll gcd(ll a,ll b){
  if(a<b)swap(a,b);
  ll c=a%b;
  while(c!=0){
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}

int main(){
  int n; cin>>n;
  ll ans;
  rep(i,n){
    ll t; cin>>t;
    if(i==0)
    ans=t;
    else{
      ll c=gcd(ans,t);
      ans=(ans/c)*(t/c)*c;
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import sys

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

def main():
    s=SI()
    cnt=0
    for i in range(len(s)-1):
        if s[i]!=s[i+1]:cnt+=1
    print(cnt)

main()

Measured memory_bytes: 3316