akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
long long H,W;
vector<string> S(410);
long long cnt=0;
long long cnt2=0;
bool w[410][410];

void dfs(int a,int b,bool q){
  w[a][b]=false;
  if(q){
    //枠外に出ておらず、まだ訪れていない
    if(a-1>=0 && S[a-1][b]=='.' && w[a-1][b]){
      w[a-1][b]=false; cnt++; dfs(a-1,b,0);
    }
    if(a+1<H && S[a+1][b]=='.' && w[a+1][b]){
      w[a+1][b]=false; cnt++; dfs(a+1,b,0);
    }
    if(b-1>=0 && S[a][b-1]=='.' && w[a][b-1]){
      w[a][b-1]=false; cnt++; dfs(a,b-1,0);
    }
    if(b+1<W && S[a][b+1]=='.' && w[a][b+1]){
      w[a][b+1]=false; cnt++; dfs(a,b+1,0);
    }
  }
  else{
    if(a-1>=0 && S[a-1][b]=='#' && w[a-1][b]){
      w[a-1][b]=false; cnt2++; dfs(a-1,b,1);
    }
    if(a+1<H && S[a+1][b]=='#' && w[a+1][b]){
      w[a+1][b]=false; cnt2++; dfs(a+1,b,1);
    }
    if(b-1>=0 && S[a][b-1]=='#' && w[a][b-1]){
      w[a][b-1]=false; cnt2++; dfs(a,b-1,1);
    }
    if(b+1<W && S[a][b+1]=='#' && w[a][b+1]){
      w[a][b+1]=false; cnt2++;dfs(a,b+1,1);
    }
  }
}
 
int main(){
  long long ans=0;
  cin >> H >> W;
  for(int I=0;I<H;I++){
    for(int J=0;J<W;J++){w[I][J]=true;}
  }
  for(int i=0;i<H;i++)cin >> S[i];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(S[i][j]=='#' && w[i][j]){
        for(int I=0;I<H;I++){
          //for(int J=0;J<W;J++){w[I][J]=true;}
        }
        cnt=0; cnt2=1;
        dfs(i,j,true);
        ans+=cnt*cnt2;
        //cout << ans << endl;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 13056
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
char s[105][105];
int main()
{
   ios::sync_with_stdio(false);
   int n,m;
   while(cin>>n>>m)
   {
      for(int i=0;i<n;i++)
         cin>>s[i];
      for(int i=0;i<m+2;i++)
         cout<<"#";
      cout<<endl;
      for(int i=0;i<n;i++)
         cout<<"#"<<s[i]<<"#"<<endl;
      for(int i=0;i<m+2;i++)
         cout<<"#";
      cout<<endl;
   }
   return 0;
}


Measured memory_bytes: 256
A,B,C,D = map(int,input().split())
def gcd(x,y):
  if x<y:
    l = y
    k = x
    x = y
    y = k
  else:
    k = y
    l = x
  z = x%y
  while z != 0:
    x = y
    y = z
    z = x%y
  return (k//y)*(l//y)*y

if A%C ==0:
  i = (A//C)-1
else:
  i = A//C

j = B//C

if A%D ==0:
  k = (A//D)-1
else:
  k = A//D

l = B//D

if A%(gcd(C,D)) ==0:
  m = (A//(gcd(C,D)))-1
else:
  m = A//gcd(C,D)
  
n = B//gcd(C,D)

#print(i,j,k,l,m,n)
#print(B-A+1,j-i,l-k,n-m)
print((B-A+1)-(j-i)-(l-k)+(n-m))

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

int main(){
	int n,r;
	while(cin >> n >> r){
		if(n==0 && r==0) break;
		int card[51];
		for(int i=0; i<n; i++){
			card[i] = n-i;
		}

		for(int j=0; j<r; j++){
			int p,c;
			cin >> p >> c;

			vector<int> change;
			// Cツづ個閉板閉ェ
			for(int i=p-1; i<p-1+c; i++){
				change.push_back(card[i]);
			}
			
			// P-1ツづ個閉板閉ェ
			for(int i=0; i<p-1; i++){
				change.push_back(card[i]);
			}
			/*
			for(int i=p-1+c; i<n; i++){
				change.push_back(card[i]);
			}
			*/
			int count=0;
			vector<int>::iterator it = change.begin();
			while(it!=change.end()){
				card[count] = *it;
				count++;
				it++;
			}
		}
		cout << card[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

int main()
{
	int ABC[3];
	int K;
	for (int i = 0; i < 3; ++i)
	{
		std::cin >> ABC[i];
	}
	std::cin >> K;
	if (K <= 0)
	{
		std::cout << 0 << "\n";
		return 0;
	}

	int mulNum[3];
	mulNum[0] = 1;
	mulNum[1] = 0;
	mulNum[2] = -1;
	int answer = 0;
	for (int i = 0; i < 3; ++i)
	{
		if (K <= 0)
		{
			break;
		}

		if (ABC[i] == 0)
		{
			continue;
		}

		if (ABC[i] >= K)
		{
			answer += (mulNum[i] * K);
			break;
		}
		else
		{
			K -= ABC[i];
			answer += (mulNum[i] * ABC[i]);
		}
	}

	std::cout << answer << "\n";

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() {
    int N;
    int t[100010], x[100010], y[100010];

    cin >> N;
    for(int i = 1; i <= N; i++) cin >> t[i] >> x[i] >> y[i];
    t[0] = x[0] = y[0] = 0;

    bool can_gaol = true;
    int seconds = 0;
    int distance = 0;
    for(int i = 1; i <= N; i++) {
        seconds = t[i] - t[i-1];
        distance = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);

        if(distance <= seconds && seconds % 2 == distance % 2) continue;
        else can_gaol = false;
    }

    if(can_gaol) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <memory>
#include <algorithm>

int main(int argc, const char * argv[]) {
    int N;
    std::cin >> N;
    std::string str;
    std::vector<std::string> vec;
    
    for(int i=0;i<N;i++){
        std::cin >> str;
        vec.push_back(str);
    }
    
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
        
    // insert code here...
    std::cout << vec.size();
    return 0;
}

Measured memory_bytes: 11636
package main

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

func main() {
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	var sum int
	for i := 1; i <= n; i++ {
		sum += i * (n - i + 1)
	}
	for i := 0; i < n-1; i++ {
		sc.Scan()
		u, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		v, _ := strconv.Atoi(sc.Text())
		var l, r int
		if u < v {
			l, r = u, v
		} else {
			l, r = v, u
		}
		sum -= l * (n - r + 1)
	}
	fmt.Println(sum)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 4964
#include<stdio.h>
main()
{
	int a,b;
	char op;
	scanf("%d",&a);
	scanf(" %c",&op);
	scanf("%d",&b);
	if(op == '+')
	{

		printf("%d\n",a+b);
	}
	else
	{

		printf("%d\n",a-b);
	}

}


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

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    bool ans=false;
    
    for(int i=0; i<b; i++) if(a * i %b ==c) ans = true;
    
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] cost = new int[n+1][n+1];
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				cost[i][j] = Integer.MAX_VALUE;
			}
		}
		
		for(int i=0;i<n;i++){
			int r = sc.nextInt();
			int u = sc.nextInt();
			for(int j=0;j<u;j++) cost[r][sc.nextInt()] = 1;
		}
		for(int i=0;i<n;i++) cost[i][i] = 0;
			
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				for(int k=1;k<=n;k++){
					if(cost[j][i]!=Integer.MAX_VALUE && cost[i][k]!=Integer.MAX_VALUE){
						cost[j][k] = Math.min(cost[j][k], cost[j][i]+cost[i][k]);
					}
				}
			}
		}
			
		int p = sc.nextInt();
		for(int i=0;i<p;i++){
			int s = sc.nextInt();
			int d = sc.nextInt();
			int v = sc.nextInt();
			if(cost[s][d]>=v) System.out.println("NA");
			else System.out.println(cost[s][d]+1);
		}	
	}	
}

Measured memory_bytes: 26288
import java.util.Scanner;

class Main{
 public static void main(String[] args){
  Scanner stdIn = new Scanner(System.in);
   final double pi = 3.141;
   int R = stdIn.nextInt();
   double Enshu = 2 * pi * R;
   
   System.out.println(Enshu);
 }
}

Measured memory_bytes: 35736
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
signed main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	puts(((((a*100)+(b*10)+c)%4)?("NO"):("YES")));
	return 0;
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

long long getGcd(long long a, long long b) {
    if (a < b) swap(a, b);
    long long r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

void solve(long long N, std::vector<long long> A){
    vector<ll> gcdLeft(N), gcdRight(N);
    gcdLeft[0] = A[0];
    gcdRight[N-1] = A[N-1];
    rep(i,1,N) {
        gcdLeft[i] = getGcd(gcdLeft[i-1], A[i]);
    }
    rrep(i,0,N-1) {
        gcdRight[i] = getGcd(gcdRight[i+1], A[i]);
    }
    ll answer = max<ll>(gcdLeft[N-2], gcdRight[1]);
    rep(i,1,N-1) {
        answer = max<ll>(answer, getGcd(gcdLeft[i-1], gcdRight[i+1]));
    }
    cout << answer << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 2560
#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 P, Q, R;
	cin >> P >> Q >> R;
	cout << min({ P + Q,Q + R,P + R }) << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
// #define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset( a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

inline bool checkBit(ll n, int i) { return n & (1LL << i); }
inline ll setBit(ll n, int i) { return n | (1LL << i); }
inline ll resetBit(ll n, int i) { return n & (~(1LL << i)); }

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

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }



int main() {
    optimize();
    int a, b;
    cin >> a >> b;
    ll A = 0, B = 0;
    for (int i = 0; i < b; ++i) A = A * 10 + a;
    for (int i = 0; i < a; ++i) B = B * 10 + b;
    cout << (A >= B ? A : B) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;
void swap(int &a, int &b);

int main()
{
	int n;
	cin >> n;
	int *a = new int[n];

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

	for (int i = n - 1; i != 0; --i)
		cout << a[i] << " ";
	cout << a[0] << endl;

	return 0;
}




Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

signed main(void) {
    int deg[4];
    rep(i, 4) deg[i] = 0;
    rep(i, 3) {
        int a,b; cin >> a >> b;
        deg[a-1]++;
        deg[b-1]++;
    }

    int od = 0;
    int ev = 0;
    rep(i, 4) {
        if (deg[i] % 2 == 0) ev++;
        else od++;
    }

    if (od == 4) cout << "NO" << endl;
    else cout << "YES" << endl;
 

    return 0;
}

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

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


int main() {
    int n,i;
    cin>>n;
    int b[n-1];

    REP(i,n-1)
    {
        cin>>b[i];
    }

    int a[n];


    a[n-1] = b[n-2];

    for(int i=n-2;i>0;i--)
    {
        a[i] = (b[i-1]<b[i])? b[i-1]:b[i]; 
    }

    a[0] = b[0];




    int sum = 0;

    REP(i,n)
    {
        sum+=a[i];
    }

    cout<<sum<<endl;

    
    return 0;
}


Measured memory_bytes: 256
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA
*/
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
using namespace std::tr1;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
lli dx[]={0,0,-1,1,-1,-1,1,1};
lli dy[]={1,-1,0,0,1,-1,-1,1};
lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    lli n,ev=0,i,ans;
    cin>>n;
    lli m=n;
    while(n--)
    {
        lli a;
        cin>>a;
        if(a%2==0)
        {
            ev++;
        }
    }
    ans=power(3,m)-power(2,ev);
    cout<<ans;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
bool solve(int n,int k){
    vector<int> s(k);
    vector<int> v(k,0);
    for(int i = 0;i < k;i++)cin >> s[i];
    for(int i = 0;i < n;i++)for(int j = 0;j < k;j++){
        int g;
        cin >> g;
        v[j] +=g;
    }
    bool q = true;
    for(int i = 0;i < k;i++){
        if(v[i] > s[i]){
            return false;
            
        }
       
    }
    return true;
}
int main(){
    vector<bool>a;
    while(1){
        int n,k;
        cin >> n >> k;
        if(n == 0)break;
        a.push_back(solve(n,k));
    }
    for(int i = 0;i < a.size();i++){
        if(a[i] == true){
            cout << "Yes" <<endl;
        }
        else{
            cout << "No" <<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3092
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let s:String = read();
    let s:Vec<_> = s.bytes().collect();
    let flg = s[2] == s[3] && s[4] == s[5];
    println!("{}", if flg { "Yes" } else { "No"});
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define F first
#define S second
#define pb(n) push_back(n)
const int N=3e5+6;
const ll M=1e9+7;
const ll INF=1e18;
map<int,vector<int>> mpv;
int main()
{
	int n;
	scn(n);
	// here the dp is defined as
	// dp[i] is the probability of having i-heads so far
	// 'so far' is the time variable which runs 0...n-1

	double dp[n+1]={0};
	dp[0]=1;// no coin used. so p-bality of having 0 heads if 1

	for(int i=0;i<n;i++)
	{
		double p;
		scanf("%lf",&p);
		for(int j=i+1;j>=0;j--)
		{
			dp[j]=(j==0?0:dp[j-1]*p) + dp[j]*(1-p);
		} 
		// printf("%d\n",i);
		// for(int i=0;i<=n;i++)
		// 	printf("%d  %lf\n",i,dp[i]);
	}
	double ans=0;
	for(int i=1;i<=n;i++)
	{
		int h=i;
		int t=n-i;
		if(h>t)
			ans+=dp[i];
	}
	printf("%.10f\n",ans);
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long inf = 1ll << 61;
const long long mod = 998244353;
vector<int>G[100006];
int a[100006];
int dp[100006];
int ng;

bool pairnum(vector<int>V, int N) {
	sort(V.begin(), V.end());
	int s = 0;
	rep(i, V.size() - 1) {
		s += V[i];
	}
	int r = V[V.size() - 1];
	if (r > s)r = s;
	return (r + s) / 2 >= N;
}

int dfs(int now, int par) {//下から何本のパスを上に引き上げられるか
	if (dp[now] != -inf)return dp[now];
	vector<int>V; int S = 0;
	for (int e : G[now]) {
		if (e==par)continue;
		V.push_back(dfs(e, now));
		S += dp[e];
	}
	if (V.empty()) {
		return dp[now] = a[now];
	}

	int P = S - a[now], Q = a[now] - P;
	if (P < 0 || Q < 0)ng++;
	if (!pairnum(V,P))ng++;
	return dp[now] = Q;
}
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n - 1) {
		int x, y; cin >> x >> y;
		x--; y--;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	rep(i, n)dp[i] = -inf;
	int par;
	rep(i, n) {
		if (G[i].size() == 1)par = i;
	}
	dfs(par, -1);
	if (ng)puts("NO");
	else puts("YES");
}

Measured memory_bytes: 21376
#include <stdio.h>

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

    for(int i = 0; i < N; i++){
        int A;
        scanf("%d", &A);

        X += (D - 1) / A + 1;
    }

    printf("%d\n", X);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int H1,M1,H2,M2,K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int time;
    time = (H2 - H1) * 60 + (M2 - M1);



    printf("%d\n", time-K);


}

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

int n;
int x[30], y[30];

double dist(int a, int b){
    return sqrt((x[a]-x[b])*(x[a]-x[b]) + (y[a]-y[b])*(y[a]-y[b]));
}

bool solve(){
    for(int i=0;i<n;i++){
        if(dist(n, 0) + dist(0, i) >= dist(n+1, i)) return false;
    }
    return true;
}

int main(){
    while(1){
        cin >> n;
        if(n == 0) break;
        cin >> x[n] >> y[n] >> x[n+1] >> y[n+1];
        for(int i=0;i<n;i++){
            cin >> x[i] >> y[i];
        }

        if(solve()) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

int main() {

    ll N;
    cin >> N;

    ll a[N + 1];
    ll b[N + 1];//0 or 1

    for(ll i = 1; i <= N; ++i)
    {
        cin >> a[i];
    }

    for(ll i = N; i >= 1; --i)
    {
        ll tmp = 0;
        ll j = i + i;
        while(j <= N)
        {
            tmp += a[j];
            j = j + i;//倍数を取りに行く
        }
        if(a[i] != tmp % 2)
        {
            b[i] = 1;
            a[i] = 1;
        }
        else
        {
            b[i] = 0;
            a[i] = 0;
        }

    }
    
    //1を探す
    ll cnt = 0;

    for(ll i = 1; i <= N; ++i)
    {
        if(b[i] == 1)++cnt;
    }

    cout << cnt << endl;

    if(cnt != 0)
    {
        for(ll i = 1; i <= N; ++i)
        {
            if(b[i] == 1){
                cout << i << ' ';
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3968
#include<cstdio>
#include<cstring>

#define MAX 100005



struct Data{
	char name[11];
	int num;
};


Data d[MAX];
int head,tail,n;


void enqueue(Data t){
	d[tail] = t;
	tail = (tail+1)%MAX;
}

Data dequeue(){
	int tmp = head;
	head = (head+1)%MAX;
	return d[tmp];
}

int isEmpty(){
	return tail==head;
}

int main(){
	
	int time,now=0;
	scanf("%d %d",&n,&time);
	
	for(int i=0;i<n;i++){
		scanf("%s %d",d[i].name,&d[i].num);
	}
	
	head = 0 ;
	tail = n;
	
	while(head != tail){
		Data tmp = dequeue();
		if(time < tmp.num){
			tmp.num-=time;
			now += time;
			enqueue(tmp);
		}else{
			now+=tmp.num;
			printf("%s %d\n",tmp.name,now);
		}
		
		
	}
	return 0;
	
}

Measured memory_bytes: 4172
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,i,sum=0;
  cin>>n;
  int a[n+1],dp[n+1];
  for(i=1;i<=n;i++)
      cin>>a[i];
  dp[1]=0;
  dp[2]=abs(a[2]-a[1]);
  for(i=3;i<=n;i++)
  {
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  }
  cout<<dp[n]<<endl;
}


Measured memory_bytes: 1024
#include "stdio.h"
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(int argc, char const *argv[]) {
  int N,M;
  scanf("%d%d", &N,&M);
  int X[M];
  for (size_t i = 0; i < M; i++) {
    scanf("%d", &X[i]);
  }
  if (N>=M) {
    printf("0");
    return 0;
  }
  qsort(X, M, sizeof(int), compare_int);
  int l =X[M-1]-X[0];
  // printf("%d", l);
  int Y[M-1];
  for (size_t i = 0; i < M-1; i++) {
    Y[i]=X[i+1]-X[i];
  }
  qsort(Y, M-1, sizeof(int), compare_int);
  // for (size_t i = 0; i < M-1; i++) {
  //   printf("%d ", Y[i]);
  // }
  for (size_t i = 0; i < N-1; i++) {
    l=l-Y[M-2-i];
  }
  printf("%d", l);
  return 0;
}


Measured memory_bytes: 1268
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var r = ReadIntArray();
            if (r[0] <= r[2] && r[1] >= r[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

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

int main() {
  int n,m;
  cin >> n >> m;
  
  vector<int> vec(n);
  
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += vec.at(i);
  }
  
  int ans = 0;
  for(int i = 0; i < n; i++) {
      if(vec.at(i) * (4 * m) >= sum){
      ans++;
      }
  }
  
  if(ans >= m){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef long long ll;

ll f(ll a,ll b){return (a<b)?b:a;}

int main(){
	ll n,k,ans=0;
	cin>>n>>k;
	ll a[n],s[n+1],t[n+1];
	rep(i,n)cin>>a[i];
	rep(i,n){
		if(i==0){
			s[i]=a[i];
			t[i]=f(a[i],0);
		}else{
			s[i]=s[i-1]+a[i];
			t[i]=t[i-1]+f(a[i],0);
		}
	}
	rep(i,n-k+1){
		if(i==0)ans=f(ans,s[i+k-1]+t[n-1]-t[i+k-1]);
		else ans=f(ans,f(0,s[i+k-1]-s[i-1])+t[i-1]+f(t[n-1]-t[i+k-1],0));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> P;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int N, ans = 0;
    cin >> N;

    for (int i = 0; i * i <= N; i++) {
        ans = i * i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void rollDice(int faceNumber[], char cmdNow){
	switch(cmdNow){
		int temp;
		case 'E':
			temp = faceNumber[1];
			faceNumber[1] = faceNumber[4];
			faceNumber[4] = faceNumber[6];
			faceNumber[6] = faceNumber[3];
			faceNumber[3] = temp;
			return;
		case 'N':
			temp = faceNumber[1];
			faceNumber[1] = faceNumber[2];
			faceNumber[2] = faceNumber[6];
			faceNumber[6] = faceNumber[5];
			faceNumber[5] = temp;
			return;
		case 'S':
			temp = faceNumber[1];
			faceNumber[1] = faceNumber[5];
			faceNumber[5] = faceNumber[6];
			faceNumber[6] = faceNumber[2];
			faceNumber[2] = temp;
			return;
		case 'W':
			temp = faceNumber[1];
			faceNumber[1] = faceNumber[3];
			faceNumber[3] = faceNumber[6];
			faceNumber[6] = faceNumber[4];
			faceNumber[4] = temp;
			return;
	}
		
}

void doDice(int faceNumber[], char cmd[]){
	int cmdLen = strlen(cmd);
	int i ;
	int cmdNow;
	for(i = 0 ; i < cmdLen ; i++){
		cmdNow = cmd[i];
		rollDice(faceNumber, cmdNow);
	}
	
	
}



int main(){
	/*input 6 faces of number*/
	int faceNumber[7];
	int i ;
	for(i = 1 ; i < 7 ; i++){
		scanf("%d", &faceNumber[i]);
	}
	/*input command*/
	char cmd[101];
	scanf("%s", &cmd);
	/*do dice*/
	doDice(faceNumber, cmd);
	/*print the number on top*/
	printf("%d\n", faceNumber[1]);
	return 0 ;
} 


Measured memory_bytes: 2084
sa,sb,sc=map(str,[input() for i in range(3)])
card=sa[0]
sa=sa[1:]
while True:
    if card=="a":
        if len(sa)==0:
            print("A")
            break
        else:
            card=sa[0]
            sa=sa[1:]
    elif card=="b":
        if len(sb)==0:
            print("B")
            break
        else:
            card=sb[0]
            sb=sb[1:]
    else:
        if len(sc)==0:
            print("C")
            break
        else:
            card=sc[0]
            sc=sc[1:]

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(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 fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vl l(m), r(m), d(m), loc(n, 0);
	vector<vector<pii>> g(n);
	vb vstd(n, false);
	rep(i, m) {
		cin >> l[i] >> r[i] >> d[i];
		l[i]--; r[i]--;
		g[l[i]].push_back(pii(r[i], d[i]));
		g[r[i]].push_back(pii(l[i], -d[i]));
	}
	ll ans = true;
	for (int i = 0; i < n&&ans; i++) {
		if (!vstd[i]) {
			queue<int> q;
			q.push(i);
			//vstd[i] = true;
			loc[i] = 0;
			while (!q.empty()) {
				if (!vstd[q.front()]) {
					vstd[q.front()] = true;
					rep(j, g[q.front()].size()) {
						int to = g[q.front()][j].fs;
						int dis = g[q.front()][j].sc;
						if (vstd[to]) {
							if (loc[to] != loc[q.front()] + dis)ans = false;
						}
						else {
							q.push(to);
							loc[to] = loc[q.front()] + dis;
						}
					}
				}
				q.pop();
			}
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 14720
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using vec = vector<T>;
template<typename T> using prior = priority_queue<T>;

const ll MOD = 1e9+7;
const ll SPMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;
 
#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define siz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define Unique(v) v.rs(unique(ALL(v))-v.begin())
#define EB emplace_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define __ <<' '<<
#define kiyohime ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

// template
ll POW();
int gcd(int a, int b);
// end of template

#define N 210

int v[N];
int l;

void go(int k){
    if(k == l){
        v[k] = 1;
        l++;
        return ;
    }
    
    if( v[k] < 9 && (k+1 == l || abs(v[k] + 1 - v[k+1]) <= 1 )){
        v[k]++;
    } else {
        go(k+1);
        v[k] = max(0, v[k+1] - 1);
    }
}

void solve(){
    int n;
    
    cin >> n;
    while(n--){
        go(0);
//        for(int i=l-1; i>=0; i--)
//            cout << v[i] ;
//        cout << '\n';
    }
    
    for(int i=l-1; i>=0; i--)
        cout << v[i] ;
    cout << '\n';
}

int main(){
    kiyohime
    int T = 1;
    
//    cin >> T;
    while(T--){
        solve();
    }
}


// templates

ll POW(ll a, ll b, ll m = MOD){
    ll res = 1;
    while(b){
        if(b&1) res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a[100];
double f[100][100];
int main() {
	int n;
	cin>>n;
	for (int i=0; i<n;i++) cin>>a[i];
	sort(a, a+n);
	for (int i=0; i<n; i++)  f[i][i]=a[i];

	for (int l=1; l<n; l++) 
	for (int i=0; i<n-l; i++) {
		int r=i+l;
		f[i][r]=(f[i][i]+f[i+1][i+l])/2.0; 
		for (int j=i+1; j<=i+l; j++)
		f[i][r]=max(f[i][r], (f[i][j]+f[j+1][r]) /2.0);
	}
	printf("%.10lf", f[0][n-1]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)

using namespace std;

int i,j,k;

int main(){
    long s,ans;
    ans=0;
    cin >>s;
    long hund=s/500;
    long five=s%500/5;
    ans=hund*1000+five*5;
    cout<<ans<<endl;
    

    
    
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 605
#define P 1000000007
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;

int n, ans, k1, k2, a[MAXN], tag[MAXN], f[MAXN][305][305];

inline int add(int x, int y) {return x+y>=P?x+y-P:x+y;}
inline int sub(int x, int y) {return x>=y?x-y:x-y+P;}

int main()
{
    scanf("%d", &n);
    for(rint i=1; i<=n*2; ++i) scanf("%d", &a[i]);
    for(rint i=1; i<=n*2; i+=2)
    {
        if(a[i]==-1 && a[i+1]==-1) k1++;
        else if(a[i]==-1) k2++, tag[a[i+1]]=1;
        else if(a[i+1]==-1) k2++, tag[a[i]]=1;
        else tag[a[i]]=2, tag[a[i+1]]=2;
    }
    f[n*2+1][0][0]=1;
    for(rint i=n*2; i>=1; --i)
    {
        for(rint j=0; j<=k2; ++j)
            for(rint k=0; k<=k1+k2; ++k)
            {
                if(tag[i]==1)
                {
                    f[i][j][k]=add(f[i][j][k], f[i+1][j][k+1]);
                    if(j) f[i][j][k]=add(f[i][j][k], f[i+1][j-1][k]);
                }
                if(tag[i]==0)
                {
                    if(k) f[i][j][k]=add(f[i][j][k], f[i+1][j][k-1]);
                    f[i][j][k]=add(f[i][j][k], 1LL*(j+1)*f[i+1][j+1][k]%P);
                    f[i][j][k]=add(f[i][j][k], f[i+1][j][k+1]);
                }
                if(tag[i]==2) f[i][j][k]=f[i+1][j][k];
                //printf("%d %d %d %d %d!!!!\n", tag[i], i, j, k, f[i][j][k]);
            }
    }
    ans=f[1][0][0];
    for(rint i=1; i<=k1; ++i) ans=1LL*ans*i%P;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 218880
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int main() {
     string word;
     int count, index;

     while(true) {
         cin >> word;
         if (word == "-") {
             break;
         }
         cin >> count;

         for (int i = 0; i < count; i++) {
            cin >> index;
            word = word.substr(index, word.size() - index) + word.substr(0, index);
         }

         cout << word << endl;
     }
}

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

int main() {
  int N, K, Q, tmp;
  cin >> N >> K >> Q;
  vector<int> H(N+1,0);
  
  for(int i=0; i<Q; i++) {
    cin >> tmp;
    H[tmp]++;
  }

  for(int i=1; i<=N; i++) {
    if(K-Q+H[i]<=0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>

#define REP(i,n) for(int i=0; i<n; i++)
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
 
#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9

using namespace std;
typedef long long ll;

int main(){
	int d, g, score[10004], p[11], c[11], psum=0;
	ll ans=INF;
	
	cin >> d >> g;
	
	REP(i,d){
		cin >> p[i] >> c[i];
		REP(j, p[i]){
			score[psum] += 100*i;
			psum += 1;
		}
	}
	
	for (int i=0; i<(1<<d); i++){
		// debug(i);
		ll x = 0, kari=0;
		REP(j, d){
			if ((i>>j) & 1){
				// debug(j);
				x += 100*(j+1)*p[j]+c[j];
				// debug(x);
				kari += p[j];
			}
		}
		
		if (kari>ans){
			// debug(kari);
			continue;
		}
		if (x>=g){
			// debug(x);
			ans = min(ans, kari);
			continue;
		}
		
		//cerr << "kihon" << endl;
		
		for (int j=d-1; j>=0; j--){
			// debug(j);
			if (!((i>>j) & 1)){
				REP(k, p[j]){
					x += 100*(j+1);
					if (k==p[j]-1) x += c[j];
					kari += 1;
					if (x>=g){
						ans = min(ans, kari);
						j = -1;
						break;
					}
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


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

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

void solve(long long N, long long M, long long Q, std::vector<long long> L, std::vector<long long> R, std::vector<long long> p, std::vector<long long> q) {
  vector<vector<ll>> c(N + 1, vector<ll>(N + 1));
  vector<vector<ll>> cs(N + 1, vector<ll>(N + 2));
  rep(i, M) {
    ++c[L[i]][R[i]];
  }
  rep(i, N + 1) rep(j, N + 1) cs[i][j + 1] = cs[i][j] + c[i][j];
  rep(i, Q) {
    ll ans = 0;
    repr(j, p[i], q[i] + 1) ans += cs[j][q[i] + 1] - cs[j][p[i] - 1];
    cout << ans << endl;
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  long long Q;
  scanf("%lld", &Q);
  std::vector<long long> L(M);
  std::vector<long long> R(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &L[i]);
    scanf("%lld", &R[i]);
  }
  std::vector<long long> p(Q);
  std::vector<long long> q(Q);
  for (int i = 0; i < Q; i++) {
    scanf("%lld", &p[i]);
    scanf("%lld", &q[i]);
  }
  solve(N, M, Q, std::move(L), std::move(R), std::move(p), std::move(q));
}


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

int n;
map<long long int, int> m;
int a[200010];

int main () {

	cin >> n;
	long long int sol = 0;
	long long int zbr = 0;
	m[0] ++;
	for (int i = 0; i <n; i ++) {
		cin >> a[i];
		zbr += a[i];
		sol += m[ zbr ];
		m[ zbr ] ++;
	}
	cout << sol;

	return 0;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;
int n, a[100010];
ll calc(ll s) {
  ll sum = 0, res = 0;
  for (int i = 0; i < n; ++i, s *= -1) {
    sum += a[i];
    if (sum * s > 0) continue;
    res += abs(sum - s);
    sum += s * abs(sum - s);
  }
  return res;
}
int main() {
  cin >> n;
  rep(i, n) cin >> a[i];
  cout << min(calc(1), calc(-1)) << endl;
  return 0;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.BitSet;
import java.util.NoSuchElementException;
import java.util.PrimitiveIterator;
import java.util.Scanner;

class Main{
	private static final int n=1000001;
	static Scanner s=new Scanner(System.in);
	static int gInt() {return Integer.parseInt(s.next());}
	static long gLong() {return Long.parseLong(s.next());}

	public static void main(String[]$){
		BitSet p=new PrimeIterator(n).bs;

		int[]a=new int[n];
		for(int i=1;i<n;i+=2)
			if(p.get(i)&&p.get((i+1)/2))
				a[i]=1;
		Arrays.parallelPrefix(a,Integer::sum);
		for(int q=gInt();q>0;--q)
			System.out.println(-a[gInt()-1]+a[gInt()]);
	}
	public static class PrimeIterator implements Iterable<Integer>,PrimitiveIterator.OfInt{
		private BitSet	bs;
		private int		curv,limit;

		public PrimeIterator(int limit){
			curv=0;
			bs=new BitSet(limit+1);
			this.limit=limit;
			constructBS();
		}
		private final void constructBS(){
			bs.set(0,limit+1);
			bs.clear(0);
			bs.clear(1);
			if(limit<2) return;

			int i=1;
			while(sieve(i=bs.nextSetBit(i+1)))
				;
		}
		protected boolean sieve(int v){
			if((long)v*v>limit)
				return false;
			for(int i=v*v;i<=limit;i+=v)
				bs.clear(i);
			return true;
		}
		@Override
		public boolean hasNext(){
			int r=getNextValue();
			return 0<=r&&r<=limit;
		}
		private int getNextValue(){
			return bs.nextSetBit(curv+1);
		}
		@Override
		public int nextInt(){
			int r=getNextValue();
			if(r<0||limit<r) throw new NoSuchElementException();
			return curv=r;
		}
		@Override
		public OfInt iterator(){
			return this;
		}
		public BitSet getClonedBitSet(){
			return bs.get(0,limit+1);
		}
	}
}


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

int count_melds(int* cnt)
{
    int i;
    int maxi = 0;

    for (i = 1; i < 10; ++i){
        if (3 <= cnt[i]){
            cnt[i] -= 3;
            maxi = max(maxi, 1 + count_melds(cnt));
            cnt[i] += 3;
        }
        if (i <= 7 && cnt[i] && cnt[i + 1] && cnt[i + 2]){
            --cnt[i];
            --cnt[i + 1];
            --cnt[i + 2];
            maxi = max(maxi, 1 + count_melds(cnt));
            ++cnt[i];
            ++cnt[i + 1];
            ++cnt[i + 2];
        }
    }

    return maxi;
}

bool has_hand(int* cnt)
{
    for (int i = 1; i < 10; ++i){
        if (2 <= cnt[i]){
            cnt[i] -= 2;
            int melds = count_melds(cnt);
            cnt[i] += 2;
            if (melds == 4) return true;
        }
    }

    return false;
}

int main(void)
{
    int tile;

    while (~scanf("%1d", &tile)){
        int cnt[10] = {0};
        vector<int> waiting;

        ++cnt[tile];
        for (int i = 1; i < 13; ++i){
            scanf("%1d", &tile);
            ++cnt[tile];
        }

        for (int i = 1; i < 10; ++i){
            if (cnt[i] == 4) continue;

            ++cnt[i];
            if (has_hand(cnt)){
                waiting.push_back(i);
            }
            --cnt[i];
        }

        if (waiting.empty()){
            puts("0");
        }
        else {
            printf("%d", waiting[0]);
            for (int i = 1; i < waiting.size(); ++i) printf(" %d", waiting[i]);
            puts("");
        }
    }

    return 0;
}

Measured memory_bytes: 3048
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//数値の入力
		String a = sc.next();
        String b = sc.next();
      	//aとbの入力が同じとき正直者
      	if(a.equals(b)){
        	System.out.println("H");
        }else{
          	System.out.println("D");
        }
     }
}

Measured memory_bytes: 35604
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
const ll mo = 1e10 +7;
const int M = 100+50;
const ll mod = 998244353;
int main(){
	int n,k;
	string s;
	cin>>n>>k>>s;
	if(s[k-1]=='a'){
		s[k-1]='A';
	}else if(s[k-1]=='b'){
		s[k-1]='B';
	}else if(s[k-1]=='c'){
		s[k-1]='C';
	}else if(s[k-1]=='A'){
		s[k-1]='a';
	}else if(s[k-1]=='B'){
		s[k-1]='b';
	}else if(s[k-1]=='C'){
		s[k-1]='c';
	}
	cout<<s<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define M_PI 3.141592653589793238462643383279502884L

int main() {
	ios;
	int n, m;
	cin>>n>>m;
	int a, sum = 0;
	for (int i = 0; i < m; i++) {
		cin>>a;
		sum += a;
	}
	n >= sum ? cout<<(n - sum) : cout<<-1;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

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

ll lcm(ll x, ll y) {
    return x*y / gcd(x,y);
}

int main(void)
{
    IOS
    ll a,b; cin >> a >> b;
    ll g = gcd(a,b);
    set<ll> v;
    for (auto i = 1; i <= sqrt(g); i++) {
        if (g % i == 0) {
            v.insert(i);
            v.insert(g/i);
        }
    }

    ll ans = 0;
    for(auto i : v) {
        bool b = true;
        for(auto j : v) {
            ll g2 = gcd(i,j);
            if (g2 == i || g2 == 1) continue;
            else {
                b = false;
                break;
            }
        }
        if (b) ans++;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

int main() {
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);

  int N, M, C;
  cin >> N >> M >> C;

  int B[30][30];
  for(int i = 0;i <= N;i++) {
    for(int j = 0;j < M;j++) {
      cin >> B[i][j];
    }
  }

  int ans = 0;
  for(int i = 1;i <= N;i++) {
    int sum = C;
    for(int j = 0;j < M;j++) {
      sum += B[i][j]*B[0][j];
    }

    if(sum > 0) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256