akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int n, m;
    int k[11], s[11][11], p[11];
    int ans = 0;

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++) {
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> p[i];
    }

    for (int bit = 0; bit < (1<<n); bit++) {
        int light[11] = {};
        bool flg = true;
        for (int i = 0; i < n; i++) {
            if (bit & (1<<i)) {
                light[i] = 1;
            }
        }
        for (int i = 0; i < m; i++) {
            int cnt = 0;
            for (int j = 0; j < k[i]; j++) {
                if(light[s[i][j]-1]) {
                    cnt++;
                }
            }
            if (cnt%2 != p[i]) {
                flg = false;
                break;
            }
        }

        if (flg) {
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
// "include" {{{
#include <deque>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
// }}}
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

vector<double> x;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int r,d,x;
	cin >> r >> d >> x;
	int tmp;
	tmp = r * x - d;
	cout << tmp << '\n';
	rep(i,9){
		tmp = tmp * r -d;
		cout << tmp << '\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#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()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int N,T;
	cin >> N >> T;
	int c,t;
	int ans = INF;
	for (int i = 0;i< N;i++){
		cin >> c >> t;
		if (t <= T){
			ans = min(ans,c);
		}
	}
	if (ans == INF)
		cout << "TLE" <<endl;
	else
		cout << ans <<endl;
	return 0;
}

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int N, M;
int a,b;
int cnt[51];
int main() { 
    cin >> N >> M;
    rep(i, M) {
        cin >> a >> b;
        cnt[a]++;
        cnt[b]++;
    }

    rep(i, N + 1) if(i) cout << cnt[i] << endl;
    
    return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

//nの最大値が1e5の時とかは使える
const int MAX = 510000;
const int MOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理 O(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(){
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n+1);
  a[0] = 1;
  COMinit();
  rep(i,n){
    a[i+1] = a[i] * (m-1);
    a[i+1] %= mod;
  }
  ll ans = 0;
  rep(i,k+1){
    t1 = COM(n-1, i) * a[n-i-1];
    t1 %= mod;
    ans += m * t1;
    ans %= mod;
    //cout << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 16724
'use strict';
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\s/);
const N = input[0];
let result;

if (N === '1') {
  result = 'Hello World';
} else { // N === '2'
  const A = Number(input[1]);
  const B = Number(input[2]);
  result = A + B;
}

console.log(result);

Measured memory_bytes: 21064
import math
n, h = map(int, input().split())
a = []
b = []
for i in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

a_max = max(a)
throw_cand = []

for i in range(n):
    if b[i] >= a_max:
        throw_cand.append(b[i])
throw_cand.sort()

ans = 0
while h > 0:
    if len(throw_cand) > 0:
        kb = throw_cand.pop()
        h -= kb
        ans += 1
    else:
        ans += math.ceil(h / a_max)
        h -= math.ceil(h / a_max) * a_max

print(ans)


Measured memory_bytes: 12168
import sys
input=sys.stdin.readline
N=int(input())
A=list(map(int,input().split()))
A.sort()
Devide_N=10**9+7
Rem_2_32_DN=(2**32)%Devide_N

if N%2==1:
  if (A[0]!=0 or A[1]==0 if N>2 else A[0]!=0):
    print(0)

  else:
    del A[0]
    for ch_n in range(1,(N-1)//2+1):
      if A[0]!=ch_n*2 or A[1]!=ch_n*2:
        break
      else:
        del A[0:2]
    else:
      exp=(N-1)//2
      
      exp_quotient_32=exp//32
      exp_rem_32=exp%32
      Rem_ans_Devide_N=1
      for _ in range(exp_quotient_32):
        Rem_ans_Devide_N=(Rem_ans_Devide_N*Rem_2_32_DN)%Devide_N
        
      print((Rem_ans_Devide_N*2**(exp_rem_32))%Devide_N)
      sys.exit()
    print(0)

else:
  for ch_n in range(1,N//2+1):
    if A[0]!=ch_n*2-1 or A[1]!=ch_n*2-1:
      break
    else:
      del A[0:2]
  else:
    exp=N//2
    
    exp_quotient_32=exp//32
    exp_rem_32=exp%32
    Rem_ans_Devide_N=1
    for _ in range(exp_quotient_32):
      Rem_ans_Devide_N=(Rem_ans_Devide_N*Rem_2_32_DN)%Devide_N
      
    print((Rem_ans_Devide_N*2**(exp_rem_32))%Devide_N)
    sys.exit()
  print(0)




Measured memory_bytes: 14072
#include <cstdio>

int main()
{
    int sx, sy, tx, ty;
    scanf("%d %d %d %d", &sy, &sx, &ty, &tx);
    int x = sx;
    int y = sy;
    for (int i = 0; i < (tx - sx); i++) {
        printf("U");
        x++;
    }

    for (int i = 0; i < (ty - sy); i++) {
        printf("R");
        y++;
    }
    for (int i = 0; i < (tx - sx); i++) {
        printf("D");
        x--;
    }

    for (int i = 0; i < (ty - sy) + 1; i++) {
        printf("L");
        y--;
    }

    for (int i = 0; i < (tx - sx) + 1; i++) {
        printf("U");
        x++;
    }

    for (int i = 0; i < (ty - sy) + 1; i++) {
        printf("R");
        y++;
    }
    printf("D");
    x--;
    printf("R");
    y++;

    for (int i = 0; i < (tx - sx) + 1; i++) {
        printf("D");
        x--;
    }

    for (int i = 0; i < (ty - sy) + 1; i++) {
        printf("L");
        y--;
    }
    printf("U\n");
    x++;

    return 0;
}


Measured memory_bytes: 128
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ab = []
for ai in a:
  for bi in b:
    ab.append(ai + bi)
ab.sort(reverse = True)

abc = []

for abi in ab[:k]:
  for ci in c:
    abc.append(abi + ci)
abc.sort(reverse = True)

for abci in abc[:k]:
  print(abci)


Measured memory_bytes: 151644
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
using namespace std;

vector<int> e[2001];
int g[2001][2001]={},visit[2001][2001];
int dfs(int x,int y){
  visit[x][y]=1;
  for(int i=0;i<e[y].size();i++)
    if(visit[x][e[y][i]]==0){
      g[x][e[y][i]]=g[x][y]+1;
      dfs(x,e[y][i]);
    }
  return 0;
}
int main(){
  int n,k,a[2000],b[2000],ans,cnt;
  scanf("%d %d",&n,&k);
  ans=n;
  for(int i=0;i<n-1;i++){
    scanf("%d %d",&a[i],&b[i]);
    e[a[i]].push_back(b[i]);
    e[b[i]].push_back(a[i]);
  }
  for(int i=1;i<=n;i++)
    dfs(i,i);
  if(k%2==0){
    for(int i=1;i<=n;i++){
      cnt=0;
      for(int j=1;j<=n;j++)
        if(g[i][j]>k/2)
          cnt++;
      if(ans>cnt)
        ans=cnt;
    }
  }
  else{
    for(int i=0;i<n-1;i++){
      cnt=0;
      for(int j=1;j<=n;j++)
        if(min(g[a[i]][j],g[b[i]][j])>(k-1)/2)
          cnt++;
      if(ans>cnt)
        ans=cnt;
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 31744
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;


int main(int argc, char **argv) {
    i64 n,m;
    cin >> n >> m;

    cout << (n * m )<< endl;

    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main()
{
	char in[20] = {};
	int i, len = 19;
	scanf("%s", in);
	for (i = 0; i < 20; i++) {
		if (in[i] == 0) {
			len = i;
			break;
		}
	}
	for(i = len; i >= 0; i--) {
		printf("%c", in[i]);
	}
	printf("\n");
	return 0;
}

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

void Main() {
    int n, a;
    cin >> n >> a;
    cout << n * n - a << endl;
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>

using namespace boost::multiprecision;
*/

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define debug(aa, a) fprintf(stderr, aa, a)

using ll =long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int k, x;
	scanf("%d%d", &k, &x);
	k *= 500;
	printyn(k >= x);

	Please AC;
}


Measured memory_bytes: 760
#include <cstdio>
#include <iostream>
#include <cassert>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int nNode;
int vs[100000+10];
int parity[100000+10];
int lbs[100000+10];
int ubs[100000+10];
vector<int> g[100000+10];

bool go(int u, int p) {
  REP(i, g[u].size()) {
    int v = g[u][i];
    if(v == p)
      continue;
    if(!go(v, u))
      return false;
  }
  if(lbs[u] > ubs[u] || parity[u] == 0) { // 無理
    return false;
  }
  if(lbs[u] == ubs[u] && (parity[u] & (1 << (lbs[u] % 2))) == 0) {
    return false;
  }
  if(p >= 0) {
    REP(i, 2) {
      if((parity[u] & (1 << i)) == 0) {
        parity[p] &= ~(1 << !i);
      }
    }
    lbs[p] = max(lbs[p], lbs[u]-1);
    ubs[p] = min(ubs[p], ubs[u]+1);
  }
  return true;
}

void go2(int u, int p) {
  int value;
  if(p < 0) {
    value = lbs[u];
    if((parity[u] & (1 << (value%2))) == 0) {
      ++value;
    }
  } else {
    value = lbs[p]-1;
    if(value < lbs[u]) {
      value += 2;
    }
  }
  lbs[u] = ubs[u] = value;
  
  REP(i, g[u].size()) {
    int v = g[u][i];
    if(v == p)
      continue;
    go2(v, u);
  }
}

int main(void) {
  scanf("%d", &nNode);
  REP(i, nNode-1) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  REP(i, nNode) {
    parity[i] = 3;
    lbs[i] = 0;
    ubs[i] = 1000000;
  }
  int nInit;
  scanf("%d", &nInit);
  REP(i, nInit) {
    int v, p;
    scanf("%d%d", &v, &p);
    --v;
    lbs[v] = ubs[v] = p;
    parity[v] = 1 << (p % 2);
  }

  bool ok = go(0, -1);
  if(ok) {
    puts("Yes");
    go2(0, -1);
    REP(i, nNode) {
      assert(lbs[i] == ubs[i]);
      printf("%d\n", lbs[i]);
    }
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 15360
#include<bits/stdc++.h>
#define f first 
#define sf second.first 
#define ss second.second 
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P > iP;

int main(){
  int t,p,r,b;
  while(cin>>b>>t>>p>>r&&t){
    iP a[51];
    int k[11][51]={};
    a[0]=iP(-1,P(-1,-1));
    for(int i=1;i<=t;i++)a[i]=iP(0,P(0,i));
    for(int i=0;i<r;i++){
      int ti,pi,m,s;
      cin>>m>>ti>>pi>>s;
      if(!s)a[ti].f++,a[ti].sf-=m+k[pi][ti]*20;
      else k[pi][ti]++;
    }
    sort(a+1,a+t+1);
    for(int i=t;i>0;i--){
      cout<<a[i].ss;
      if(i!=1)
	if(a[i-1].f==a[i].f&&a[i-1].sf==a[i].sf)cout<<"=";
	else cout<<",";
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n,c;cin>>n>>c;
  bool rokuga[30][100010]={};
  for(int i=0;i<n;i++){
    int s,t,C;cin>>s>>t>>C;
    for(int j=s;j<=t;j++)rokuga[C-1][j]=true;
  }
  int ma=0;
  int sum=0;
  for(int i=0;i<=100000;i++){
    int cnt=0;
    for(int j=0;j<c;j++){
      if(rokuga[j][i])cnt++;
    }
    ma=max(ma,cnt);
  }
  cout<<ma<<endl;
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int>a(n+1);
  rep(i,n)cin>>a[i+1];
  vector<int>b(n+1);
  for(int i=n;i>=1;--i){
    int sum=0;
    for (int j=i+i;j<=n;j+=i){
      sum^=b[j];
    }
    b[i]=sum^a[i];
  }
  vector<int>ans;
  for (int i=1;i<=n;i++){
    if(b[i]) ans.push_back(i);
  }
  cout<<ans.size()<<endl;
  rep(i,ans.size()){
    printf("%d%c",ans[i],i+1==ans.size()?'\n':' ');
  }
  return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Long = long long;
using pii = pair<Long,Long>;

struct C {
    Long p, y, id = 0;
    bool operator < (const C &o) const {
        if (p != o.p) return p < o.p;
        return y < o.y;
    }
};
vector<string> anw(100010, "");
int cnt[100010];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<C> V, Z;
    memset(cnt, 0, sizeof(cnt));
    for(int i = 0; i < m; i++) {
        C tem;
        cin >> tem.p >> tem.y;
        tem.id = i + 1;
        V.push_back(tem);
    }
    Z = V;
    sort(V.begin(), V.end());
    for(auto &t : V) {
        string f = to_string(t.p);
        int k = 0;
        while(k < 6-f.size()) {
            anw[t.id] +="0";
            k++;
        }
        anw[t.id] += f;
        int cur = ++cnt[t.p];
        string s = to_string(cur);
        k = 0;
        while(k < 6-s.size()) {
            anw[t.id] +="0";
            k++;
        }
        anw[t.id] += s;
    }
    for(auto i : Z) {
        cout << anw[i.id] << '\n';
    }
    return 0;
}

Measured memory_bytes: 13680
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto t = readln.chomp.split.to!(int[]);
  auto m = readln.chomp.to!int;
  auto lsum = t.sum;
  foreach (i; 0..m) {
    auto x = readln.chomp.split.to!(int[]);
    writeln(lsum - t[x[0]-1] + x[1]);
  }
}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let mut b: Vec<usize> = (0..n).map(|_| iterator.next().unwrap().parse().unwrap()).collect();

    let mut a: Vec<usize> = Vec::new();

    while !b.is_empty() {
        let mut found = false;
        for i in (0..b.len()).rev() {
            if b[i] == i + 1 {
                a.push(b.remove(i));
                found = true;
                break;
            }
        }
        if !found {
            break;
        }
    }

    if !b.is_empty() {
        return "-1".to_string()
    }

    return a.iter().rev().map(|it| it.to_string()).collect::<Vec<String>>().join("\n");
}


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

int main()
{
int b;
int a;
int n;
int x;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> a;
	cin >> b;

	n = b - a;
	x = n * ( n - 1 ) / 2;

	cout << x - a << endl;

	return 0;
}


Measured memory_bytes: 256
build = []
each1 = []
each2 = []
each3 = []
each4 = []


for i in range(30):
    each1.append(0)
    each2.append(0)
    each3.append(0)
    each4.append(0)

build.append(each1)
build.append(each2)
build.append(each3)
build.append(each4)


n = int(input())

for i in range(n):
    b, f, r, v = map(int,input().split())
    build[b-1][(f-1)*10+r-1]+=v


for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" %d" %build[i][j*10+k],end="")
        print()
    if i !=3:
        print(20*"#")



Measured memory_bytes: 5616
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
if b == 1:
  b = 14
if a == 1:
  a = 14
if a < b:
  print('Bob')
elif a > b:
  print('Alice')
else:
  print('Draw')









Measured memory_bytes: 27164
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const double pi = 3.14159265358979323846;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
  int n,k,sum=0;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  for(int i=0;i<k;i++)
    sum+=a[i];
  cout<<sum;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>

using namespace std;

int main () {

    string W;

    cin >> W;

    int cnt = 0;
    while (1) {
        string T; 
        cin >> T;

        if (T == "END_OF_TEXT") {
            break;
        }

        for (int i = 0; ; i++) {

            if (T[i] == 0) {
                break;
            }

            if ('A' <= T[i] && T[i] <= 'Z') {
                T[i] += 32;
            }
        }

        if (T == W) {
            cnt++;
            // cout << "count++" << endl;
        }
    }

    cout << cnt << endl;

    return 0;

}


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

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<int> alive(N+1);
    for(int i=0; i<=N; i++) {
        alive.at(i) = 1;
    }
    for(int j=0; j<M; j++) {
        int a;
        cin >> a;
        alive.at(a) = 0;
    }
    vector<long long int> dp(N+1);
    dp.at(0) = 1;
    dp.at(1) = alive.at(1);
    for(int i=2; i<=N; i++) {
        dp.at(i) = alive.at(i) * (dp.at(i-1) + dp.at(i-2)) % 1'000'000'007;
    }
    cout << dp.at(N) << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

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

    if(n * 2 >= m){
        ans = m / 2;
    }else{
        ll diff = m - 2 * n;
        ans = n + diff / 4;
    }
    cout << ans << endl;
}

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

int main() {
	int h,w;cin>>h>>w;
	char s[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>s[i][j];
		}
	}
	int flag=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(s[i][j]=='#'){
				int flag2=0;
				if(i!=0){
					if(s[i-1][j]=='#'){
						flag2=1;
					}
				}
				if(i!=h){
					if(s[i+1][j]=='#'){
						flag2=1;
					}
				}
				if(j!=0){
					if(s[i][j-1]=='#'){
						flag2=1;
					}
				}
				if(j!=w){
					if(s[i][j+1]=='#'){
						flag2=1;
					}
				}
				if(flag2==0){
					flag=0;
				}
			}
		}
	}
	if(flag){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

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

int main(){
  long long int N,A,B,x;
  cin >> N >> A >> B;
  x=N/(A+B);
  if(N%(A+B)>=A)
    cout << x*A+A << endl;
  else if(N%(A+B)>0)
    cout << x*A+N%(A+B) << endl;
  else
    cout << x*A << endl;
}

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

int main(){
    char s;
    cin >> s;
    if(s=='a') cout << 'b' << endl;
    if(s=='b') cout << 'c' << endl;
    if(s=='c') cout << 'd' << endl;
    if(s=='d') cout << 'e' << endl;
    if(s=='e') cout << 'f' << endl;
    if(s=='f') cout << 'g' << endl;
    if(s=='g') cout << 'h' << endl;
    if(s=='h') cout << 'i' << endl;
    if(s=='i') cout << 'j' << endl;
    if(s=='j') cout << 'k' << endl;
    if(s=='k') cout << 'l' << endl;
    if(s=='l') cout << 'm' << endl;
    if(s=='m') cout << 'n' << endl;
    if(s=='n') cout << 'o' << endl;
    if(s=='o') cout << 'p' << endl;
    if(s=='p') cout << 'q' << endl;
    if(s=='q') cout << 'r' << endl;
    if(s=='r') cout << 's' << endl;
    if(s=='s') cout << 't' << endl;
    if(s=='t') cout << 'u' << endl;
    if(s=='u') cout << 'v' << endl;
    if(s=='v') cout << 'w' << endl;
    if(s=='w') cout << 'x' << endl;
    if(s=='x') cout << 'y' << endl;
    if(s=='y') cout << 'z' << endl;
}

Measured memory_bytes: 3604
N,M=(int(x) for x in input().split())
L=[]
D=[0]*M

for i in range(N):
    L.append(tuple(int(x) for x in input().split()))

L = sorted(L, key=lambda x:-x[1])
pay=0
mn=-1
for ab in L:
    flag=True
    if ab[0]<=M and mn<M-ab[0]:
        i=0
        while True:
            if M-ab[0]-i<0:
                break
            if mn>M-ab[0]-i:
                break
            D[M-ab[0]-i]+=1
            if D[M-ab[0]-i]==1:
                pay+=ab[1]
                flag=False
                break
            else:
                if i==1:
                    i+=1
                else:
                    i+=D[M-ab[0]-i]-1
            
        if flag:
            mn=M-ab[0]
            
print(pay)


Measured memory_bytes: 67544
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll n;
ll k;
ll a[305];
ll d[305][305];
ll ans = 4e18;

int main()
{
    scanf("%lld%lld", &n, &k);
    for(ll i = 1; i <= k; i++) d[0][i] = 4e18;
    for(ll i = 1; i <= n + 1; i++)
    {
        if(i <= n) scanf("%lld", &a[i]);
        for(ll j = 0; j <= k; j++)
        {
            d[i][j] = 4e18;
            for(ll l = 0; l <= min(j, i - 1); l++)
            {
                d[i][j] = min(d[i][j], d[i - l - 1][j - l] + max(0LL, a[i] - a[i - l - 1]));
            }
        }
    }
    for(ll i = 0; i <= k; i++)
    {
        ans = min(ans, d[n + 1][i]);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1024
s = []
N = int(input())
sum = 0

for i in range(N):
    s.append(int(input()))
    sum += s[i]

if (sum % 10) == 0:
    s.sort()
    for i in range(N):
        if (s[i] % 10) != 0:
            sum -= s[i]
            break
    if (sum % 10) == 0:
        print("0")
    else:
        print(sum)
else:
    print(sum)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, val;
    cin >> n;
    unordered_map<int, int> cnt;
    for(int i = 0; i < n; i++) {
        cin >> val;
        cnt[val] += 1;
    }
    int ans = 0, tmp = 0;
    for(auto p: cnt) {
        tmp = p.second;
        if (cnt.count(p.first+1) > 0)
            tmp += cnt[p.first+1];
        if (cnt.count(p.first-1) > 0)
            tmp += cnt[p.first-1];
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3724
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <fstream>
#include <functional>

using namespace std;
using ll = long long;

#define all(x) (x).begin(),(x).end()
#define PRI(n) cout << n << " "<<endl;
#define PRI2(n, m) cout << n << " " << m << " "<<endl;

#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define FOR(i, t, n)  for(int i = t; i <= (int)n; ++i)

const char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                           's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
const ll MOD = 1e9 + 7;

struct edge;
struct UnionFind;

bool isPrime(ll x);

ll GCD(ll a, ll b);

ll LCM(ll a, ll b);

ll nCr(int n, int r);


struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int N) {
        for (int i = 0; i < N; ++i) {
            par.push_back(i);
            rank.push_back(0);
        }
    }

    int find(int x) {
        if (par[x] == x)return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)return;
        if (rank[x] < rank[y])par[x] = y;
        else {
            par[y] = x;
            if (rank[x] == rank[y])rank[x]++;
        }
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

ll M, N;
bool s[10][10];
bool p[10];

int main() {
    ll N, M;
    cin >> N >> M;
    REP(i, M) {
        int k;
        cin >> k;
        REP(j, k) {
            int n;
            cin >> n;
            s[i][n-1] = 1;
        }
    }
    REP(i, M)cin >> p[i];
    int ans = 0;
    for (int bit = 0; bit < (1 << N); ++bit) {
        int a[10] = {};
        REP(i, M) {
            REP(j, 10) {
                if (bit & (1 << j)) {
                    if (s[i][j])a[i]++;
                }
            }
        }
        int cnt = 0;
        REP(i, M) {
            if ( a[i] % 2 == p[i])cnt++;
        }
        if (cnt == M)ans++;
    }
    PRI(ans)
    return 0;
}

struct edge {
    int to, cost;
    bool flag = false;
};

bool isPrime(ll x) {
    if (x == 0)return 0;
    if (x == 1)return 0;
    if (x == 2)return 1;
    if (x % 2 == 0)return 0;
    FOR(i, 3, x - 1) {
        if (x % i == 0)return 0;
    }
    return 1;
}

ll GCD(ll a, ll b) {
    if (b == 0)return a;
    return GCD(b, a % b);
}

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll nCr(int n, int r) {
    vector<ll> C(r + 1);
    C[0] = 1;
    FOR(i, 1, n) for (int j = min(i, r); j < 1; --j)C[j] = (C[j] + C[j - 1]) % MOD;
    return C[r];
}


Measured memory_bytes: 256
#include <iostream>

#define N 1000000

using namespace std;

typedef long long int BigInt;

BigInt phi(int n) {
    int m = n;
    BigInt retval = 1;
    for (int p=2; p*p <= m; p++) {
        int count = 0;
        while (m%p == 0) {
            count++;
            m /= p;
        }
        if (count > 0) {
            retval *= p-1;
            for (int i=0; i<count-1; i++) {
                retval *= p;
            }
        }
    }
    if (m > 1) {
        retval *= m-1;
    }
    return retval;
}

int main() {
    int t;
    int n[10000];
    BigInt f[N+1];
    cin >> t;
    for (int i=0; i<t; i++) {
        cin >> n[i];
    }
    f[1] = 2;
    for (int i=2; i<=N; i++) {
        f[i] = f[i-1]+phi(i);
    }
    for (int i=0; i<t; i++) {
        cout << f[n[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 9004
import java.io.*;
import java.util.*;

public class Main {
    public static PrintWriter out;
    public static FastScanner in;

    private void solve(){
        int n = in.nextInt();
        long k = in.nextLong();

        List<Long> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            long v = in.nextLong();
            if(v < k) list.add(v);
        }

        Collections.sort(list,Collections.reverseOrder());
        n = list.size();
        int start = 0,ans = n;
        long v = 0L;
        while (true){
            if(start == n){
                out.print(ans);
                return;
            }

            v+= list.get(start);
            int x;
            for(x = start+1;x<n;x++){
                if(v+list.get(x) < k){
                    v+=list.get(x);
                }else {
                    break;
                }
            }
            start = x-1;
            if(start+1 == n){
                out.print(ans);
                return;
            }

            if(v + list.get(n-1) >= k){
                out.print(0);
                return;
            }
            int idx = -1;
            for(int i= n-1;i>start;i--){
                if(v+list.get(i) >= k){
                    idx = i;
                    break;
                }
            }

            if(idx == -1){
                out.print(ans);
                return;
            }
            //out.println(v + " " + start + " " + idx);
            ans-=(idx-start+1);
            start = idx+1;
        }
    }

    private void runIO() {
        in = new FastScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
    }
    private static class FastScanner {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        private FastScanner() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        private String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private String nextLine() {
            String ret = "";
            try {
                ret = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return ret;
        }
    }

    public static void main(String[] args) {
        new Main().runIO();
    }
}


Measured memory_bytes: 23636
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<math.h>
#include<list>
#include<complex>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vvvll vector<vector<vector<ll>>>
#define vtype(type) vector<type>
#define vvtype(type) vector<vector<type>>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;
struct wall
{
	long long r; ll c;
	bool operator<(const wall& rhs) const {
		if (r != rhs.r) {
			return r < rhs.r;
		}
		else {
			return c < rhs.c;
		}
	}
};


ll const MOD = 1e9 + 7;


ll mod_p(ll x, ll y) {
	x %= MOD;
	y %= MOD;
	return (x + y + MOD) % MOD;
}

ll mod_m(ll x, ll y) {
	x %= MOD;
	y %= MOD;
	return x * y%MOD;
}

ll mod_pow(ll x, ll t) {
	x %= MOD;
	if (t == 0) {
		return 1;
	}
	else {
		ll v = mod_pow(x, t / 2);
		if (t % 2 == 0) {
			return v * v % MOD;
		}
		else {
			return v * v%MOD * x %MOD;
		}
	}
}

ll mod_inv(ll x) {
	return mod_pow(x, MOD - 2);
}

ll const MAX = 5e3 + 5;
vvll dp(MAX, vll(MAX, 1e17));
vll p(MAX);

int main() {
	ll n;
	cin >> n;
	ll a, b;
	cin >> a >> b;
	REP(i, 1, n) {
		cin >> p[i];
	}
	dp[0][0] = 0;
	REP(i, 1, n) {
		REP(j, 0, n) {
			if (j < p[i]) {
				dp[i][j] = min(dp[i][j], dp[i - 1][j] + a);
				dp[i][p[i]] = min(dp[i][p[i]], dp[i - 1][j]);
			}
			else if (j >= p[i]) {
				dp[i][j] = min(dp[i][j], dp[i - 1][j] + b);
			}
		}
	}
	ll ans = 1e17;
	REP(j, 1, n) {
		ans = min(dp[n][j], ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 198144
#include <stdio.h>

int main()
{
    int a, b, i, count;
    char str[6];
    scanf("%d%d", &a, &b);
    count = 0;
    for (i=a; i<=b; i++)
    {
        snprintf(str, 6, "%d", i);
        if (str[0] == str[4] && str[1] == str[3]) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))

template <typename T>
struct edge
{
    int src, to;
    T cost;
    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};

template <typename T>
using Edges = vector<edge<T>>;

template <typename T>
using WeightedGraph = vector<Edges<T>>;

using UnweightedGraph = vector<vector<int>>;

template <typename T>
using Matrix = vector<vector<T>>;

// Kahn's algorithm
// G is a DAG.
vector<int> topological_sort(const UnweightedGraph &G)
{
    const int N = G.size();
    vector<int> indegree(N, 0);
    stack<int> st; // set of vertex whose indegree is zero.

    for (auto &source : G)
    {
        for (auto &to : source)
        {
            indegree[to]++;
        }
    }

    for (int i = 0; i < N; i++)
    {
        if (indegree[i] == 0)
            st.push(i);
    }

    vector<int> ans;
    while (st.size() > 0)
    {
        int u = st.top();
        st.pop();
        ans.emplace_back(u);
        for (auto &v : G[u])
        {
            indegree[v]--;
            if (indegree[v] == 0)
                st.push(v);
        }
    }

    if (ans.size() != N)
    {
        // G is not DAG.
        return vector<int>();
    }
    return ans;
}

int main()
{
    int V, E;
    cin >> V >> E;
    UnweightedGraph G(V);
    for (int i = 0; i < E; i++)
    {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
    }
    auto d = topological_sort(G);
    if (d.size() == 0)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 3172
(defvar tl (list ""))
(defvar hd (nconc (concatenate 'list (read-line)) tl))
(defvar rev nil)

(loop repeat (read)
      do
      (if (= (read) 1)
          (setf rev (not rev))
          (if (eq (= (read) 1) rev) 
              (progn 
                (rplacd tl (list (read-char)))
                (setf tl (cdr tl)))
              (push (read-char) hd) )))

(if rev 
    (mapc #'princ (nreverse hd))
    (mapc #'princ hd))

Measured memory_bytes: 62148
#include <iostream>
using namespace std;
int main(void){
    int a1,a2,a3;
    cin >> a1;
    cin >> a2;
    cin >> a3;
    if (a1+a2+a3 < 22) {
    cout << "win" << endl;
  }
  else{
      cout <<"bust"<< endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

const long long INF = 1LL << 60;

int main(){
  string s, t;
  cin >> s >> t;

  int n = s.size();
  int m = t.size();
  
  if(n < m) cout << "LESS" << endl;
  else if(n > m) cout << "GREATER" << endl;
  else{
    rep(i, n){
      if(s[i] < t[i]){
        cout << "LESS" << endl;
        return 0;
      }
      if(s[i] > t[i]){
        cout << "GREATER" << endl;
        return 0;
      }
    }
    cout << "EQUAL" << endl;
  }

  return 0;
}


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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5");
            WillReturn.Add("10 4 8 7 3");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("7");
            WillReturn.Add("4 4 5 6 6 5 5");
            //3
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("4");
            WillReturn.Add("1 2 3 4");
            //0
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] HArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();

        int Answer = 0;
        int Seq = 0;
        for (int I = 1; I <= HArr.GetUpperBound(0); I++) {
            int Prev = HArr[I - 1];
            int Curr = HArr[I];

            if (Prev >= Curr) {
                Seq++;
            }
            else {
                Seq = 0;
            }
            Answer = Math.Max(Answer, Seq);
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 26204
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<String[]> list = new ArrayList<String[]>();
    while(true) {
        String line = sc.nextLine();
        String[] linesp = line.split(" ");
        if(linesp[0].equals("0") && linesp[1].equals("0")) {
            break;
        }
        list.add(linesp);
    }
    for(int i = 0; i < list.size(); i++) {
        int h = Integer.parseInt(list.get(i)[0]);
        int w = Integer.parseInt(list.get(i)[1]);
        for(int j = 0; j < h; j++) {
            for(int k = 0; k < w; k++) {
                System.out.print("#");
            }
            System.out.println("");
        }
        System.out.println("");
    }
  }
}


Measured memory_bytes: 34948
def input_int_list():
    return [int(thing) for thing in input().split(" ")]

def int_input():
    return int(input())


import collections
N = int_input()
A_list = input_int_list()
C = collections.Counter(A_list)
for i in range(1, N+1):
    if i in C:
        pass
    else:
        C[i] = 0

for n in range(1,N+1):
    print(C[n])



Measured memory_bytes: 37452
N, M = map(int, input().split())
vote_lst = tuple(map(int, input().split()))
ans_count = 0
total_votes = sum(vote_lst)
for votes in vote_lst:
    if votes >= total_votes/(4*M):
        ans_count += 1
if ans_count >= M:
    out_mes = "Yes"
else:
    out_mes = "No"
print(out_mes)

Measured memory_bytes: 3060
from collections import defaultdict
import sys
h, w, n = map(int,sys.stdin.readline().rstrip().split())

m3x3 =defaultdict(list)
for _ in range(n):
    a, b = map(int,sys.stdin.readline().rstrip().split())
    for i in range(max(0, a - 3),min(h - 2, a)):
        for j in range(max(0, b - 3),min(w - 2, b)):
            if (i,j) in  m3x3:
                m3x3[(i,j)] +=1
            else:
                m3x3[(i,j)] =1
v = list(m3x3.values())
k = m3x3.keys()
print((w-2)*(h-2)-len(k))
for j in range(1,10):
    print(v.count(j))


Measured memory_bytes: 155636
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
    int l,r,d;
    cin>>l>>r>>d;
    int count=0;
    int c=d;
    while(d<=r){
        if(d>=l&&d<=r)count++;
        d+=c;
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 3100
#include<stdio.h>

int main(void)
{
	int d[3];
  
  	scanf("%d %d %d",&d[0],&d[1],&d[2]);

  	int fivecnt=0,sevencnt=0;
  	
  	for(int i=0;i<3;i++)
    {
		if(d[i]==5)
        {
			fivecnt++;
        }
		else if(d[i]==7)
        {
			sevencnt++;
        }
		else
        {
			printf("NO\n");
          	return 0;
        }
    }

  	if(fivecnt==2&&sevencnt==1)
    {
      printf("YES\n");
      return 0;
    }
  
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
int main() {

	vector<int>v;
	int x = 100000;
	int dim = 0;
	while (x != 0) {
		cin >> x;
		v.push_back(x);


		dim += 1;



	}
	int number = 1;
	int a = 0;
	for (int i = 0;i < dim-1;i++) {
		
		cout << "Case" << " " << number << ":" <<" "<< v[a] << endl;
		a += 1;
		number += 1;

	}

}

Measured memory_bytes: 3212
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;

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

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            long[] p = new long[m];
            long[] y = new long[m];
            for (int i = 0; i < m; i++) {
                p[i] = in.nextLong();
                y[i] = in.nextLong();
            }

            TreeMap<Long, TreeSet<Long>> map = new TreeMap<>();
            for (int i = 0; i < m; i++) {
                if (!map.containsKey(p[i])) map.put(p[i], new TreeSet<>());
                map.get(p[i]).add(y[i]);
            }

            TreeMap<Long, TreeMap<Long, Integer>> map2 = new TreeMap<>();
            for (Long x : map.keySet()) {
                TreeMap<Long, Integer> map3 = new TreeMap<>();
                int index = 1;
                for (Long t : map.get(x)) {
                    map3.put(t, index++);
                }
                map2.put(x, map3);
            }

            for (int i = 0; i < m; i++) {
                out.println(String.format("%06d%06d", p[i], map2.get(p[i]).get(y[i])));
            }
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public long nextLong() {
            return Long.parseLong(nextString());
        }

    }
}



Measured memory_bytes: 140776
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

using pos_type = pair<int, int>;

int W, H;
vector<int> p, q;
set<pos_type> visited;

void read(int size, vector<int>& costs)
{
    costs.resize(size);
    for (int i = 0; i < size; ++i) cin >> costs[i];
}

int main()
{
    cin >> W >> H;
    read(W, p);
    read(H, q);

    sort(p.begin(), p.end());
    sort(q.begin(), q.end());
    long sum = 0;

    int pi = 0, qi = 0;
    while (true) {
        if (pi >= W and qi >= H) {
            break;
        } else if (pi < W and qi < H) {
            if (p[pi] < q[qi]) {
                sum += static_cast<long>(p[pi])*(H - qi + 1);
                ++pi;
            } else {
                sum += static_cast<long>(q[qi])*(W - pi + 1);
                ++qi;
            }
        } else if (pi >= W) {
            sum += static_cast<long>(q[qi])*(W - pi + 1);
            ++qi;
        } else if (qi >= H) {
            sum += static_cast<long>(p[pi])*(H - qi + 1);
            ++pi;
        }
    }
    cout << sum << endl;

    return 0;
} 

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int candies[3];
    rep(0, 3) cin >> candies[i];

    bool found = false;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (i != j && i!=k && j != k) {
                    if (candies[i] + candies[j] == candies[k]) {
                        found = true;
                        break;
                    }
                }
            }
        }
    }

    cout << (found ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256