akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<complex>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int I, O, _, J, L;

signed main() {
    cin >> I >> O >> _ >> J >> L;
    int ans = 0;
    ans += O;
    O = 0;
    if (I && J && L && I % 2 + J % 2 + L % 2 >= 2) {
        ans += 3;
        --J, --L, --I;
    }
    ans += 2 * (J / 2);
    J -= J / 2;
    ans += 2 * (L / 2);
    L -= L / 2;

    ans += 2 * (I / 2);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long gcd(long long x, long long y){
    if(x < y) swap(x, y);
    if(x % y == 0) return y;
    return gcd(y, x % y);
}
int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    vector<long long> R(N), L(N);
    L[0] = A[0];
    R[0] = A[N - 1];
    for(int i = 1; i < N; i++){
        L[i] = gcd(L[i - 1], A[i]);
        R[i] = gcd(R[i - 1], A[N - 1 - i]);
    }
    long long g = 0;
    for(int i = 0; i < N; i++){
        if(i == 0) g = max(g, R[N - 2]);
        else if(i == N - 1) g = max(g, L[N - 2]);
        else g = max(g, gcd(L[i - 1],R[N - i - 2]));
    }
    cout << g << endl;
}


Measured memory_bytes: 5528
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;
int main(){
    int s;
    cin >> s;
    int a,b,c;
    a = s/3600;
    b = (s%3600)/60;
    c = s%60;
    cout << a <<":" << b << ":" << c <<endl;
    
    }


Measured memory_bytes: 3096
#include <stdio.h>

int main(){
  int i,total,price,missing=0,sum=0;
  while(1){
     sum=0;
     missing=0;
    scanf("%d",&total);
    if(total==0){
      break;
    }
    for(i=0;i<9;i++){
      
      scanf("%d",&price);
      sum = sum + price;
    }
    missing = total-sum;
    
    printf("%d\n",missing);
  }
  return 0; 
}

Measured memory_bytes: 600
N, x = map(int, input().split())
a = list(map(int, input().split()))
a_min = sorted(a)
temp = 0
count = 0
for i in range(N):
    temp += a_min[i]
    if temp > x:
        break
    count += 1
print(count - 1 if temp < x else count)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int N, M; cin >> N >> M;
  
  if (abs(N-M) > 1) {
    cout << 0 << endl;
    return 0;
  }
  
  ll ans = 1;
  rep(i,N) (ans *= i+1) %= MOD;
  rep(i,M) (ans *= i+1) %= MOD;
  if (N == M) (ans *= 2) %= MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int hc[1125750],wc[1125750];
main()
{
	int n,m;
	while(cin>>n>>m,n){
	int h[1501]={},w[1501]={};
	for(int i=1;i<=n;i++)cin>>h[i];
	for(int i=1;i<=n;i++)h[i]+=h[i-1];
	for(int i=1;i<=m;i++)cin>>w[i];
	for(int i=1;i<=m;i++)w[i]+=w[i-1];
	int c=0;
	for(int i=0;i<=n;i++)for(int j=i+1;j<=n;j++)hc[c++]=h[j]-h[i];
	int d=0;
	for(int i=0;i<=m;i++)for(int j=i+1;j<=m;j++)wc[d++]=w[j]-w[i];
	int cnt=0;
	sort(hc,hc+c);sort(wc,wc+d);
	for(int i=0;i<c;i++)
	{
		cnt+=upper_bound(wc,wc+d,hc[i])-lower_bound(wc,wc+d,hc[i]);
	}
	cout<<cnt<<endl;}
}

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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  rep(i,N) cin >> d[i];
  
  int ans = 0;
  for(int i = 0; i < N; i++) {
    for(int j = i+1; j < N; j++) {
      ans += d[i] * d[j];
    }
  }
  cout << ans << endl;
  return 0;
}

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


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


Measured memory_bytes: 3636
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

int main(){
  int a,b; cin >> a >> b;
  
  if(a > 9 || b > 9){
    cout << -1 << endl;
  }else{
    cout << a*b << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = b; i >= (a); --i)
#define repdl(i, a, b) for(ll i = b; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool ihmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
#endif
using namespace std;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int k; read(k);
  int x = 7 % k;
  rep(i, 1, 1000005) {
    if (x == 0)
      die(i);
    x = (x * 10 + 7) % k;
  }
  die(-1);
}



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

int main(){
  string s;
  cin >> s;
  bool flag = (s.size()%2 == 0);
  while(s.size()>0 && flag){
    if(s.substr(0,2) == "hi"){
      s = s.substr(2,s.size()-2);
    }
    else flag = 0;
  }
  cout << (flag?"Yes":"No") << endl;
}

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

int sum=0;
vector<vector<int> > v;
vector<bool>l;
int n,m;

void dfs(int p,int num)
{
  if(num==n)
    sum++;
  else{
    l[p]=false;

    for(auto z:v[p]){
      if(l[z]==true)
        dfs(z,num+1);
    }

    l[p]=true;
  }
}


int main()
{
  cin >> n >> m;
  v.resize(n);
  l.resize(n,true);

  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(0,1);

  cout << sum << endl;

}

Measured memory_bytes: 256
H,W = map(int,input().split())
_input = []
for i in range(H):
    row = list(map(str,input().split()))
    row = '#' + row[0] + '#'
    _input.append(row)

for i in range(H+2):
    if i == 0 or i == H+1:
        for j in range(W+2):
            if j == W+1:
                print('#')
            else:
                print('#',end='')
    else:
        print(_input[i-1])


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	vi v(5);

	REP(i, 5) {
		cin >> v[i];
	}

	int k;

	cin >> k;

	REP(i, 5) {
		REP(j, 5) {
			if (i == j) {
				continue;
			}

			if (abs(v[i] - v[j]) > k) {
				cout << ":(" << endl;
				return 0;
			}
		}
	}

	cout << "Yay!" << endl;

	

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
#include<array>
#include<algorithm>
#include<queue>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
#include<bitset>
#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//array<int, 4>dir_x2 = { 0,0,1,-1 };
//array<int, 4>dir_y2 = { 1,-1,0,0 };
//char alp[] = { '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' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI  r;
//	if (x < y) {
//		swap(x, y);
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x, LLI y) {
//	return x / gcd(x, y) * y;
//}

//long nCr(int n, int r) {
//	long ans = 1;
//	for (int i = n; i > n - r; i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; i++) {
//		ans = ans / i;
//	}
//	return ans;
//}
//long nHr(int n,int r) {
//	n = n + r - 1;
//	return nCr(n,r);
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI N,Min = 1e9;
	cin >> N;
	vector<LLI>vec(N);
	for (int i = 0; i < N;i++) {
		cin >> vec[i];
	}
	LLI left = 0, right = 0;
	for (int i = 0; i < N - 1;i++) {
		left = 0;
		right = 0;
		for (int j = 0; j <= i;j++) {
			left += vec[j];
		}
		for (int j = i + 1; j < N;j++) {
			right += vec[j];
		}
		Min = min(Min,abs(right - left));
	}
	cout << Min << endl;
}

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut ok = false;
    if s.len() >= 4 {
        let a = &s[0..4];
        if a == "YAKI" {
            ok = true;
        }
        else{
            ok = false;
        }
    }else{
        ok = false;
    }
    if ok {
        println!("Yes");
    } else {
        println!("No")
    }
}


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

int main () {
  vector<vector<int>>A(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>A.at(i).at(j);}}
  int N;
  cin>>N;
  vector<int>b(N);
  for(int j=0;j<N;j++){
    cin>>b.at(j);}
  vector<vector<bool>>P(3,vector<bool>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      P.at(i).at(j)=false;
      for(int k=0;k<N;k++){
       if(A.at(i).at(j)==b.at(k)){P.at(i).at(j)=true;}}}}
  string judge="No";
  for(int i=0;i<3;i++){
        if(P.at(i).at(0)&&P.at(i).at(1)&&P.at(i).at(2)){judge="Yes";}}
  for(int i=0;i<3;i++){
        if(P.at(0).at(i)&&P.at(1).at(i)&&P.at(2).at(i)){judge="Yes";}}
  if(P.at(0).at(0)&&P.at(1).at(1)&&P.at(2).at(2)){judge="Yes";}
  if(P.at(2).at(0)&&P.at(1).at(1)&&P.at(0).at(2)){judge="Yes";}
   
  cout<<judge<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;



public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double x1 = 0;
		double y1 = 0;
		double x2 = 0;
		double y2 = 0;
		double x3 = 0;
		double y3 = 0;
		double xp = 0;
		double yp = 0;


		while(scan.hasNextDouble()){
			x1 = scan.nextDouble();
			y1 = scan.nextDouble();
			x2 = scan.nextDouble();
			y2 = scan.nextDouble();
			x3 = scan.nextDouble();
			y3 = scan.nextDouble();
			xp = scan.nextDouble();
			yp = scan.nextDouble();

			double j12 = judge(x1, y1, x2, y2, xp, yp);
			double j23 = judge(x2, y2, x3, y3, xp, yp);
			double j31 = judge(x3, y3, x1, y1, xp, yp);

			if((j12>0 && j23>0 && j31>0) || (j12<0 && j23<0 && j31<0)){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}

		}

	}

	static double judge(double x1 ,double y1, double x2, double y2, double xp, double yp){
		return ( (y2-y1)*xp + (x1-x2)*yp + x2*y1 - x1*y2);
	}

}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (i + 1 == k) {
      cout << (char)(s[i] - 'A' + 'a');
    } else {
      cout << s[i];
    }
  }
  cout << endl;
}


Measured memory_bytes: 764
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

struct Edge { int src, dst; };

class DisjointSet {
public:
  vint v;
  DisjointSet(int n) : v(n, -1) {}

  int root(int n) { return v[n] < 0 ? n : (v[n] = root(v[n])); }
  bool unite(int a, int b) {
    int ra = root(a), rb = root(b);
    if (ra == rb) return false;
    if (-ra > -rb) swap(ra, rb);
    v[rb] += v[ra];
    v[ra] = rb;
    return true;
  }
  int size() { return count_if(ALL(v), [](int x){ return x < 0; }); }
};


const int N = 100001;

int main() {
  int n;
  while (cin >> n) {
    vint x(n), y(n);
    REP(i,n) cin >> x[i] >> y[i];

    auto vx = [](int x) { return x; };
    auto vy = [](int y) { return N + y; };

    DisjointSet ds(N + N);
    REP(i,n) ds.unite(vx(x[i]), vy(y[i]));
    vint cx(N + N), cy(N + N);
    REP(i,N) {
      cx[ds.root(vx(i))]++;
      cy[ds.root(vy(i))]++;
    }

    ll result = 0;
    REP(i,N+N) result += (ll)cx[i] * cy[i];
    cout << result - n << endl;
  }
}


Measured memory_bytes: 3456
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    char N[4];
    cin >> N;

    if((N[0] == N[1] || N[2] == N[3]) && N[1] == N[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll H,W,K;
    cin >> H >> W >> K;
    vector<string> S(H);
    rep(i,H){
        cin >> S[i];
    }
    ll ans = 1e18;
    for(ll i=0; i < (ll(1) << (H-1)); i++){
        vector<ll> v;
        v.push_back(0);
        rep(j,H-1){
            if((i >> j)&ll(1)){
                v.push_back(j+1);
            }
        }
        v.push_back(H);
        vector<ll> memo(v.size()-1);
        ll cnt = v.size()-2;
        bool flag = false;
        rep(j,W){
            rep(k, v.size()-1){
                for(ll l=v[k]; l<v[k+1]; l++){
                    if(S[l][j] == '1')memo[k]++;
                    if(memo[k] > K){
                        flag = true;
                        break;
                    }
                }
                if(flag)break;
            }
            if(flag){
                cnt++;
                rep(k,v.size()-1){
                    memo[k]=0;
                }
                flag = false;
                rep(k, v.size()-1){
                    for(ll l=v[k]; l<v[k+1]; l++){
                        if(S[l][j] == '1')memo[k]++;
                        if(memo[k] > K){
                            flag = true;
                            break;
                        }
                    }
                    if(flag)break;
                }
                if(flag)break;
            }
            if(flag)break;
        }
        if(flag)continue;
        //cout << cnt << endl;
        cmin(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
X,N=map(int,input().split())
P=list(map(int,input().split()))
if X not in P:
    print(X)
else:
    for i in range(100):
        if X-i not in P:
            print(X-i)
            break
        elif X+i not in P:
            print(X+i)
            break

Measured memory_bytes: 9184
n=int(input())
_dict = []
for i in range(n):
    _dict.append(list(map(str, input().split())))
end_music = input()
for i in range(n):
    _dict[i][1]=int(_dict[i][1])


ans=0
start=False
for i in range(n):
    if start==True:
        ans+=_dict[i][1]
    if _dict[i][0]==end_music:
        start=True
print(ans)

Measured memory_bytes: 3064
from typing import List


def search_bomb(i: int, j: int, ss: List[str]) -> int:
    count = 0
    for k in range(i - 1, i + 2):
        for l in range(j - 1, j + 2):
            if 0 <= k <= h - 1 and 0 <= l <= w - 1:
                if ss[k][l] == '#':
                    count += 1
    return count


def answer(ss: List[str]) -> List[str]:
    result = list('' for _ in range(h))

    for i, s in enumerate(ss):
        line = ''
        for j, c in enumerate(s):
            if c == '.':
                line += str(search_bomb(i, j, ss))
            elif c == '#':
                line += '#'
        result[i] = line

    return result


def main():
    ss = [input() for _ in range(h)]
    for line in answer(ss):
        print(line)


if __name__ == '__main__':
    h, w = map(int, input().split())
    main()


Measured memory_bytes: 10260
import itertools

n = int(input())
vs = [int(s) for s in input().split(' ')]
vs_odd = vs[0::2]
vs_odd.sort()
vs_even = vs[1::2]
vs_even.sort()
odd_group = {0: 0}
even_group = {0: 0}

for k, g in itertools.groupby(vs_odd):
    odd_group[k] = len(list(g))
for k, g in itertools.groupby(vs_even):
    even_group[k] = len(list(g))

ret = len(vs)

odd_max = max(odd_group, key=odd_group.get)
odd_max_v = odd_group[odd_max]
even_max = max(even_group, key=even_group.get)
even_max_v = even_group[even_max]
if odd_max == even_max:
    del odd_group[even_max]
    del even_group[even_max]
    odd_max2 = max(odd_group, key=odd_group.get)
    odd_max2_v = odd_group[odd_max2]
    even_max2 = max(even_group, key=even_group.get)
    even_max2_v = even_group[even_max2]
    ret -= max(odd_max_v + even_max2_v, odd_max2_v + even_max_v)
else:
    ret -= (odd_max_v + even_max_v )
print(ret)


Measured memory_bytes: 18592
/*
Hanit Banga
*/

#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 5;

int a[N], degree[N] = {0}, up[N] = {0};
bool seen[N] = {0};
vector <int> g[N];

bool solve(int cur);

int main()
{
	int n;
	cin >> n;

	for (int i = 1; i <= n; ++i)
		cin >> a[i];	

	for (int i = 1; i < n; ++i)
	{
		int u, v;
		cin >> u >> v;
		g[u].pb(v);
		g[v].pb(u);
	}

	if (n == 2)
	{
		if (a[1] == a[2])
			cout << "YES\n";

		else
			cout << "NO\n";

		return 0;
	}

	int root = 1;
	while (g[root].size() == 1)
		++root;

	if (solve(root) and up[root] == 0)
		cout << "YES\n";

	else
		cout << "NO\n";
}

bool solve(int cur)
{
	seen[cur] = true;
	ll sum = 0;
	int mx = 0;
	bool ans = true;
	for (auto &i : g[cur])
	{
		if (!seen[i])
		{
			ans &= solve(i);
			sum += up[i];
			mx = max(mx, up[i]);
		}
	}

	if (!ans)
		return false;

	if (g[cur].size() == 1)
	{
		up[cur] = a[cur];
		return true;
	}

	if (sum < a[cur] or 2*a[cur] < sum)
		return false;

	up[cur] = 2*a[cur] - sum;
	sum += up[cur];
	mx = max(mx, up[cur]);
	return (mx <= sum/2);
}

Measured memory_bytes: 11904
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,b,a) for (int i=b;i>=a;i--)
#define mes(a,b)  memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 200005;

int n, c, k, t[N];
ll ans;
int main()
{
	scanf("%d %d %d", &n, &c, &k);
	rep(i,1,n) scanf("%d", &t[i]);
	sort(t+1, t+1+n);
	for(int i=1; i<=n; i++) {
		ans++; // cout<<ans<<"  "<<i<<"----"<<endl;
		int x=t[i]+k, num=0, j;
		for(j=i; j<=n && t[j]<=x && num<=c-1; j++) num++;
		i=j-1;
	}
	printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <vector>
using namespace std;
double x_1, x_2, x_3, y_1, y_2, y_3, x_p, y_p, c;
int n,hasil;
int main(){
	while(cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_p >> y_p){
		hasil = 0;
		if((x_3*y_2)-(x_3*y_1)-(x_1*y_2) > (x_2*y_3)-(x_1*y_3)-(x_2*y_1)){
			if((x_p*y_2)-(x_p*y_1)-(x_1*y_2) > (x_2*y_p)-(x_1*y_p)-(x_2*y_1)){
				hasil++;
			}
		}
		else if((x_3*y_2)-(x_3*y_1)-(x_1*y_2) < (x_2*y_3)-(x_1*y_3)-(x_2*y_1)){
			if((x_p*y_2)-(x_p*y_1)-(x_1*y_2) < (x_2*y_p)-(x_1*y_p)-(x_2*y_1)){
				hasil++;
			}
		}
		if((x_2*y_3)-(x_2*y_1)-(x_1*y_3) > (x_3*y_2)-(x_1*y_2)-(x_3*y_1)){
			if((x_p*y_3)-(x_p*y_1)-(x_1*y_3) > (x_3*y_p)-(x_1*y_p)-(x_3*y_1)){
				hasil++;
			}
		}
		else if((x_2*y_3)-(x_2*y_1)-(x_1*y_3) < (x_3*y_2)-(x_1*y_2)-(x_3*y_1)){
			if((x_p*y_3)-(x_p*y_1)-(x_1*y_3) < (x_3*y_p)-(x_1*y_p)-(x_3*y_1)){
				hasil++;
			}
		}
		if((x_1*y_3)-(x_1*y_2)-(x_2*y_3) > (x_3*y_1)-(x_2*y_1)-(x_3*y_2)){
			if((x_p*y_3)-(x_p*y_2)-(x_2*y_3) > (x_3*y_p)-(x_2*y_p)-(x_3*y_2)){
				hasil++;
			}
		}
		if((x_1*y_3)-(x_1*y_2)-(x_2*y_3) < (x_3*y_1)-(x_2*y_1)-(x_3*y_2)){
			if((x_p*y_3)-(x_p*y_2)-(x_2*y_3) < (x_3*y_p)-(x_2*y_p)-(x_3*y_2)){
				hasil++;
			}
		}
		if(hasil == 3)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,K;cin>>N>>K;
    vector<ll> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    sort(all(A));
    ll sum=0;
    
    for(int i=0;i<N-K;i++) sum+=A[i];
    
    cout<<sum<<endl;
}




Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define pb push_back
#define pp pop_back()
#define mp make_pair
#define fr first
#define sc second
#define sz size()
#define smin(x,y) ((x)=min((x),(y)))
#define smax(x,y) ((x)=max((x),(y)))
#define all(x) x.begin(),x.end()
#define CS ios_base::sync_with_stdio(false);
#define show(x) cerr << #x << " is " << x <<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi; 
int32_t main()
{
	int k,s; cin>>k>>s;
	int ans=0;
	for(int x=0;x<=k;x++)
		for(int y=0;y<=k;y++)
			if(s-x-y <= k && s-x-y >=0) 
				ans++;
	return cout<<ans<<endl,0;
}


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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    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;
    }
}
ll 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;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    int M=in();
    vector<vector<int>>s(M);
    int _k;
    REP(i,M){
        cin>>_k;
        int temp;
        REP(j,_k){
            cin>>temp;
            s[i].pb(temp-1);
        }
        sort(all(s[i]));
    }
    vector<int>p(M);
    REP(i,M){
        cin>>p[i];
    }
    ll ans=0;
    for(int bit=0;bit<(1<<N);++bit){
        //debug(bit);
        bool flg;flg=true;
        REP(j,M){   
            int l;l=0;
            for(int id:s[j]){
                if((bit>>id)&1){
                    ++l;
                }
            }
            l%=2;
            if(l!=p[j]){
                flg=false;
            }
        }
        if(flg){
            //debug(bit);
            ans=ans+1;
        }
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int graph[101][101]={};
int d[101]={};
int f[101]={};
int n,v,k,time1 = 0,sw[101] = {};


void dfs1(int u){

  sw[u] = 1;
  d[u] = ++time1;

  for(int i = 1; i <= n; i++){
    if( graph[u][i] == 1 && sw[i] == 0 ){
     dfs1(i);
    }

  }
    f[u] = ++time1;
}


int main(){
  int u;
  cin >> n ;
  //グラフをつくる
  for(int i = 0; i < n; i++){
    cin >> u >> k ;
    for(int j = 0; j < k ; j++){
      cin >> v;
      graph[u][v] = 1;
    }
  }
 
 for(int i = 1; i <= n; i++){
    if(sw[i] == 0){
      dfs1(i);
	}
  }

  for(int i = 1; i <= n; i++ ){
    cout << i << ' ' <<  d[i]<< ' ' << f[i] << endl;

  }
}

Measured memory_bytes: 1200
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  int a,b;cin>>a>>b;
  int tmp;
  
  if((b-a==0)){
    cout<<0<<endl;
  }else if((a+b)%2==0){
    cout<<(a+b)/2<<endl;    
  }else{
    cout<<"IMPOSSIBLE"<<endl;
  }

}

Measured memory_bytes: 256
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列
using namespace std;
typedef long long ll;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //文字列入力
    string s;
    cin >> s;

    ll ans = 0;
    REP(i, 4)
    {
        if (s[i] == '+')
        {
            ans++;
        }
        else
        {
            ans--;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3612
h, w, k = map(int, input().split())

c = [[] for _ in range(h)]

for i in range(h):
    c[i] = input()

ans = 0
for mask_y in range(1 << h):
    for mask_x in range(1 << w):
        cnt = 0
        for y in range(h):
            for x in range(w):
                if c[y][x] == "#":
                    cnt += 1
                    if (mask_y >> y) % 2 == 1 or (mask_x >> x) % 2 == 1:
                        cnt -= 1
        if cnt == k:
            ans += 1

print(ans)



Measured memory_bytes: 68332
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
const int INF = 1e9;
const double pi = acos(-1.0);
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main(){
    ll n, q, s = 0; 
    cin >> n;
    map<ll, ll> mp;
    rep(i,n){
        ll a; cin >> a;
        mp[a]++;
        s += a;
    }
    cin >> q;
    rep(i,q){
        ll b, c;
        cin >> b >> c;
        mp[c] += mp[b];
        s += mp[b] * (c - b);
        mp[b] = 0;
        cout << s << endl;
    }
    return 0;
}  

Measured memory_bytes: 9412
#include<stdio.h>

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

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

int main()
{
    int n;
    int ans[4001] = {0};
    for(int i=0; i<=1000; i++){
        ans[i] = 1;
    }
    for(int i=1; i<4; i++){
        for(int j=4000; j>0; j--){
            for(int k=1; k<=1000; k++){
                if(j-k<0) break;
                ans[j] += ans[j-k];
            }
        }
    }
    while(cin>>n){
        cout<<ans[n]<<endl;
    }
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

int main(){
  llong ans = 0;
  int N;
  cin >> N;
  vector<llong> A(N);
  for(int i=0; i<N; ++i) cin >> A[i];
  map<llong, llong> mp;
  for(int i=0; i<N; ++i){
    ++mp[A[i]-(i+1)];
  }
  for(llong i=0; i<N-1; ++i){
    llong diff = A[i]-(i+1);
    llong su = A[i] + (i+1);
    --mp[diff];
    ans += mp[-su];
  }
  cout << ans << endl;
}


Measured memory_bytes: 27424
#define LOCAL

#include<bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define LLINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f

using llong = long long;
using PII = pair<int, int>;

const llong MOD = 123456789LL;
const double PI = acos(-1);

int main() {
	IOS;
	string s; cin >> s;
	string fw = "", bw = "";
	bool f = true;
	int q; cin >> q;
	while (q--) {
		int q1; cin >> q1;
		if (q1 == 1) {
			f = !f;
		}
		else {
			int q2; char c; cin >> q2 >> c;
			q2--;
			if (!q2 == f) fw += c;
			else bw += c;
		}
	}
	if (f) {
		for (int i = (int)fw.size() - 1; i >= 0; i--) {
			cout << fw[i];
		}
		cout << s;
		for (int i = 0; i < bw.size(); i++) {
			cout << bw[i];
		}
	}
	else {
		for (int i = (int)bw.size() - 1; i >= 0; i--) {
			cout << bw[i];
		}
		reverse(s.begin(), s.end());
		cout << s;
		for (int i = 0; i < fw.size(); i++) {
			cout << fw[i];
		}
	}
}

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

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

  if(a+b == c or b+c == a or c+a == b){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  int k=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)>A.at(k)){
      k=i;
    }
  }
  sort(A.begin(),A.end());
  for(int i=0;i<N;i++){
    if(i==k){
      cout<<A.at(N-2)<<endl;
    }else{
      cout<<A.at(N-1)<<endl;
    }
  }
}

Measured memory_bytes: 2432
#include <cstdio>
#include <cstdint>
#include <map>

constexpr intmax_t MOD = 1e9+7;

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

  std::map<int, int> factor;
  for (int i = 2; i <= N; ++i) {
    int m = i;
    for (int j = 2; j*j <= m; ++j) {
      while (m % j == 0) {
        ++factor[j];
        m /= j;
      }
    }
    if (m > 1) ++factor[m];
  }

  intmax_t res = 1;
  for (auto& p: factor)
    (res *= p.second+1) %= MOD;

  printf("%jd\n", res);
}


Measured memory_bytes: 256
#include <stdio.h>
char input[4];
char check1 = '+';
char check2 = '-';

int search1(char input[]){
    int i;
    int num1 = 0;

    for(i = 0; i < 4; i++){
        if(input[i] == '+'){
            num1++;
        }
    }
    return num1;
}

int search2(char input[]){
    int j;
    int num2 = 0;

    for(j = 0; j < 4; j++){
        if(input[j] == '-'){
            num2++;
        }
    }
    return num2;
}

int main(int argc, char* argv[]){

    scanf("%s", input);

    printf("%d\n", 0 + (-1)*search2(input) + 1*search1(input));

    return 0;
}

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

using ll = long long;

const ll INF = 0x33FF33FF33FF33FF;

int main() {
    int N, W;
    std::cin >> N >> W;

    std::vector<ll> w(N), v(N);
    for(int i = 0; i < N; ++i) {
        std::cin >> w[i] >> v[i];
    }

    // F[i, j]: the min weight to achieve value j with first i items
    std::vector<ll> F(100001, INF);
    F[0] = 0;
    for(int i = 1; i <= N; ++i) {
        for(int j = 100000; j >= v[i - 1]; --j) {
            F[j] = std::min(F[j], F[j - v[i - 1]] + w[i - 1]);
        }
    }

    ll ans = 0;
    for(int j = 0; j <= 100000; ++j) {
        if(F[j] <= W) {
            ans = j;
        }
    }

    std::cout << ans << "\n";
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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;
}

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;

    if ((A1 + A2 + A3) >= 22 ) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 504
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <limits>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

bool solve()
{
    int n, points, questions;
    std::cin >> n >> points >> questions;

    vector<int> players(n, 0);

    for (int i = 0; i < questions; ++i)
    {
        int winner;
        std::cin >> winner;
        --winner;

        players[winner]++;
    }

    for (int i = 0; i < n; ++i)
    {
        if (points - (questions - players[i]) > 0)
            std::cout << "Yes" << std::endl;
        else
            std::cout << "No" << std::endl;
    }

    return true;
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 1024
N , M = map(int, input().split())
H = list(map(int, input().split()))

ans = set([])
for i in range(N):
  ans.add(i+1)

#AB = []
for i in range(M):
  temp = list(map(int, input().split()))
  if H[temp[0]-1] > H[temp[1]-1]:
    if temp[1] in ans:
      ans.remove(temp[1])
  elif H[temp[0]-1] < H[temp[1]-1]:
    if temp[0] in ans:
      ans.remove(temp[0])
  else:
    if temp[0] in ans:
      ans.remove(temp[0])
    if temp[1] in ans:
      ans.remove(temp[1])
#print(ans)
print(len(ans))
  



Measured memory_bytes: 22524
#include <bits/stdc++.h>
#include <unordered_set>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N; cin >> N;
	cout << (N + 1) / 2 << '\n';
	return 0;
}

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

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  int cnt;
  cnt=B/A;
  if(cnt<C){
    cout<<cnt<<endl;
    return 0;
  }else cnt=C;
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    N, M, X = map(int, input().split())
    N, M, X = N - 1, M - 1, X - 1
    A = [A_i - 1 for A_i in map(int, input().split())]

    to_zero = len([A_i for A_i in A if A_i < X])
    to_N = len([A_i for A_i in A if X < A_i])

    print(min(to_zero, to_N))


Measured memory_bytes: 3060
from scipy.sparse import*
s=csgraph.floyd_warshall
n,m,l,*t=map(int,open(0).read().split())
d=eval('[9e9]*-~n,'*-~n)
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=d[b][a]=c
d=s(d)
d[d>l]=9e9
d[d<=l]=1
d=s(d)
d[d>9e9]=9e9
for s,t in zip(*[iter(t[m*3+1:])]*2):print(int(d[s,t]%9e9-1))

Measured memory_bytes: 40784
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  int a,b; cin >> a >> b;
  ll ans = 0;
  int m = -INF;
  for(int i = b; i < a + b; ++i)
    ans += i, m = max(m,i);
  if(b >= 0){
    ans -= b;
  }else{
    if(m >= 0) ;
    else ans -= m;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <assert.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;
typedef long long     ll;
typedef unsigned int  UInt;
#define ALL(a)          (a).begin(), (a).end()
#define FOR(i,a,b)      for(int i = a;   i <  (int)(b); ++i)
#define FOR_REV(i,a,b)  for(int i = b-1; i >= (int)(a); --i)
#define FOR_EACH(it,a)  for(remove_reference<decltype(a)>::type::iterator it = (a).begin(); it != (a).end(); ++it)
#define FOR_EACH_REV(it,a) for(remove_reference<decltype(a)>::type::reverse_iterator it = (a).rbegin(); it != (a).rend(); ++it)
#define FOR_EACH_CONST(it,a) for(remove_reference<decltype(a)>::type::const_iterator it = (a).begin(); it != (a).end(); ++it)
#define FOR_EACH_CONST_REV(it,a) for(remove_reference<decltype(a)>::type::const_reverse_iterator it = (a).rbegin(); it != (a).rend(); ++it)
template<class T> inline T   sqr(T v)  { return v * v; }
template<class T> inline int sign(T v) { return v == 0 ? 0 : (v > 0 ? 1 : -1); }
template<class T> inline int get_bit(T v, int bit_index) { return (v >> bit_index) & 1; } //return {0,1}
#define IN_INT(a)            int a;       is >> a;
#define IN_INT2(a,b)         int a,b;     is >> a >> b;
#define IN_INT3(a,b,c)       int a,b,c;   is >> a >> b >> c;
#define IN_INT4(a,b,c,d)     int a,b,c,d; is >> a >> b >> c >> d;
#define IN_LL(a)             ll a;        is >> a;
#define IN_LL2(a,b)          ll a,b;      is >> a >> b;
#define IN_LL3(a,b,c)        ll a,b,c;    is >> a >> b >> c;
#define IN_LL4(a,b,c,d)      ll a,b,c,d;  is >> a >> b >> c >> d;
#define IN_STR(s)            string s;    is >> s;

//////////////////////////////////////////////////////////////////////////

istream& input(bool release_tie = false)
{
  ios_base::sync_with_stdio(false);
#ifdef INPUT_FROM_FILE
  static ifstream is("AtCoder/input.txt");
  return is;
#endif
  if (release_tie)
    cin.tie(NULL);
  return cin;
}

ostream& output(bool release_tie = false)
{
  cout << setprecision(15);
  if (release_tie)
    cout.tie(NULL);
  return cout;
}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//

int main()
{
  istream& is = input();
  ostream& os = output();

  IN_INT2(a,b);
  cout<<a*b-a-b+1;
  return 0;
}


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

int main() {
  int a,b,c,d,e,f;

  cin >> a ;
  cin >> b;
  
  c =  (a + b) / 2;
  d =  (a + b) % 2;
  e = c + d;
  f = e - c;
  
  cout << f + c << endl;
  
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
typedef long long lld;
char buff[15];
int L, lim;
lld Ans=0, tem;

int main()
{
	scanf(" %s", buff);
	L = strlen(buff)-1;
	lim = 1 << L;
	for(int mask = 0; mask < lim; ++mask)
	{
		tem = 0;
		for(int bit = 0; bit <= L; ++bit)
		{
			tem = tem*10 + buff[bit]-'0';
			// printf("%d: %lld\n", bit, tem);
			if((mask >> bit) & 1)
			{
				Ans += tem;
				tem = 0;
			}
		}
		Ans += tem;
	}
	printf("%lld\n", Ans);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,D,Q,K,R,W,H,P,L,G;
ll ans;
string S,T;
ll y[101010];
ll a[201010];
ll k[101010];
ll b[201010];
ll d[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll v[101010];
ll s[101010];
ll x[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};
ll num[11][11];
int main() {
    cin>>L>>R;
    if(R-L >= 2019){
        cout<<0<<endl;
    }else{
        ans = INF;
        rep(i,L,R+1){
            rep(j,i+1,R+1){
                ans = min(ans,(i*j)%2019);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256