akhauriyash/Code-Regression huggingface dataset:
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<cmath>
#define lowbit(x) ((x)&(-x))
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a>b?b:a)
#define INF 0x3f3f3f3f
#define sz size()
#define pb push_back
#define ph push
#define mem(x, y) memset(x, y, sizeof(x));
#define mem0(x) mem(x,0)
#define mem1(x) mem(x,-1)
#define memINF(x) mem(x,INF)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=a;i>(b);--i)
using namespace std;
typedef long long ll;

int const Max_N = 1e6+5;
ll a[Max_N];
ll sum[Max_N] = {0};
int main()
{
 	int N;
	cin >> N;
	rep(i,1,N+1)
	{
		cin >> a[i];
		sum[i] += sum[i-1] + a[i];
	}


	ll ans = 1e18;
	rep(i,1,N)
	{
	//	cout << sum[i] << endl;
	//	cout << sum[N] - 2*sum[i] << endl;
		ans = min(ans,abs(sum[N] - 2*sum[i]));
	}
	cout << ans << endl;
	return 0;
}
	//freopen("in.txt","r",stdin);
//std::ios::sync_with_stdio(false);



Measured memory_bytes: 5888
#include <iostream>
using namespace std;
int main(){
    int n,flag=0;
    cin >> n;
    unsigned long long a[n],result=1;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(a[i]==0){
            flag=2;
            break;
        }
    }
    if(flag==2){
        cout << "0\n";
        return 0;
    }
    for(int i=0;i<n;i++){
        if(a[i]<=1000000000000000000/result){
            result *= a[i];
            if(result > 1000000000000000000){
                flag=1;
                break;
            }
        }
        else{
            flag=1;
            break;
        }
    }
    if(flag==1){
        cout << "-1";
    }
    else{
        cout << result << '\n';
    }
    return 0;
}


Measured memory_bytes: 4308
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int n,k;
  cin >> n >> k;
  
  int N[200010] = {};
  
  REP(i,n){
    int a;
    cin >> a;
    N[a]++;
  }
  
  sort(N,N+200010);
  
  int begin;
  REP(i,200010)
    if(N[i] != 0){
      begin = i; break;
    }
  
  int ans = 0;
  for(int i = 0; (200010-begin - k) > i;i++)
    ans += N[begin + i];
  
  cout << ans << endl;

 return 0;
}

Measured memory_bytes: 1024
#include <cstdio>

int main(void)
{
	int A,B,K,i;
	scanf("%d%d%d",&A,&B,&K);
	K--;
	if(A+K<B-K)
	{
		for(i=A;i<=A+K;i++)
			printf("%d\n",i);
		for(i=B-K;i<=B;i++)
			printf("%d\n",i);
	}
	else
	{
		for (i=A;i<=B;i++)
			printf("%d\n",i);
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  
  vector<string> vec(N);
  
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  
  int sum=0;
  
  bool flag=false;
  
  for(int i=0;i<N;i++){
  if(i!=0&&(vec.at(i)).at(0)!=vec.at(i-1).at(vec.at(i-1).size()-1)){
    sum++;
    flag=true;
    break;
  }
    
    for(int j=0;j<N;j++){
      
      
      
      if(vec.at(i)==vec.at(j)&&i!=j){
        
        sum++;
        
        
        flag=true;
        
       
        
        break;    
      
  }
    }
    
    
    if(flag==true){
      break;
    }
  }

      
    
  
  if(sum==0){
cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
    }
    
}

    


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

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int n = sc.nextInt();
			if (n == 0) {
				break;

			}
			int ans = 0;
			for (int i = 0; i < n / 4; i++) {
				ans += sc.nextInt();
			}
			System.out.println(ans);
		}

	}

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

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
  string S ;
  cin >> S ;
  if(S[0] != S[1] || S[1] != S[2] )cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>){
    val input = readLine()!!.split(" ")
    var a = input[0].toInt()
    var b = input[1].toInt()
    var c = input[2].toInt()

    if(a <= c && c <= b){
        println("Yes")
    }
    else if(b <= c && c <= a){
        println("Yes")
    }
    else{
        println("No")
    }
}

Measured memory_bytes: 36064
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int solve(int N, int M){
  int cnt = M, res = M;
  REP(i, N){
    int a, b; cin >>a >>b;
    cnt += a;
    cnt -= b;
    if(cnt < 0) return 0;
    res = max(res, cnt);
  }
  return res;
}

int main() {
  int N, M; cin >>N >>M;
  cout <<solve(N, M) <<endl;
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define drep(i,cc,n) for(int i=(cc);i<=(n);++i)
#define rep(i,n) drep(i,0,(n)-1)
#define drrep(i,cc,n) for(int i=(cc);i>=(n);--i)
#define rrep(i,n) drrep(i,0,(n)-1)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,v.size())if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define arrprint(v,n) rep(i,n)if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define matprint(v,n,m) rep(i,n){rep(j,m){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    string s;
    cin >> s;
    int ans = 0,ansm = 0;;
    rep(i,3){
        if(s[i] == 'R')ans++;
        else ans = 0;
        ansm = max(ans,ansm);
    }

    cout << ansm << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<P> p(m);
    rep(i,m) cin >> p[i].first >> p[i].second;

    rep(i,1000){
        int keta = 1;
        vector<int> d(1,i%10);
        int j = i / 10;
        while(j){
            keta++;
            d.push_back(j%10);
            j /= 10;
        }
        if(keta!=n) continue;
        reverse(d.begin(),d.end());
        bool ok = true;
        rep(j,m){
            if(d[p[j].first-1]!=p[j].second) ok = false;
        }
        if(ok){
            cout << i << endl;
            return 0;
        }  
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a[3]={300000,200000,100000};
    int ans=0;
    int x,y;
    cin >> x >> y;
    if ( x<=3 ) ans+=a[x-1];  
    if ( y<=3 ) ans+=a[y-1];  
    if ( x==1&&y==1 ) ans+=400000;
    cout << ans;
    return 0;
}

Measured memory_bytes: 3624
# coding: utf-8
s = input()
s += 'X'
here = 0
res = -100

for c in s:
    counter = 0
    char = c
    while char == 'A' or char == 'C' or char == 'G' or char == 'T':
        counter += 1
        char = s[here + counter]
    if counter > res:
        res = counter
    here += 1

print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main(){
    cin>>N;
    P p = mp(0,0);
    ll x, y, t, dist, lastT = 0;
    bool yes = true;
    rep(i,N){
        cin>>t>>x>>y;
        dist = abs(p.fi - x) + abs(p.se - y);
        if(dist > t - lastT) yes = false;
        if((x + y + p.fi + p.se)%2 != (t - lastT)%2) yes = false;
        p = mp(x,y);
        lastT = t;
        //cout<<yes<<endl;
    }
    cout<<(yes ? "Yes" : "No")<<endl;
}

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

using namespace std;

int main()
{
    int H,A;
    cin >> H >> A;
    if(H%A == 0){
        cout<<H/A<<endl;
    }else if(H%A != 0){
        cout<<H/A+1<<endl;
    }
    return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int D,N,i,a = 1;

    scanf("%d %d", &D,&N);

    for(i = 0;i < D;i++){
        a = a * 100;
    }

    if(N == 100)
        a = a * (N + 1);
    else a = a * N;

    printf("%d",a);

    return 0;
}

Measured memory_bytes: 128
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

N, X = map(int, input().split())

g = [1] * 51
p = [1] * 51

for i in range(1, 51):
    g[i] = 2 * g[i - 1] + 3
    p[i] = 2 * p[i - 1] + 1


def rec(n, x):
    if n == 0:
        if x == 0:
            return 0
        elif x == 1:
            return 1
    if x == 1:
        return 0

    if x <= g[n - 1] + 1:
        return rec(n - 1, x - 1)
    elif x == g[n - 1] + 2:
        return p[n - 1] + 1
    elif x <= 2 * g[n - 1] + 2:
        return rec(n - 1, x - g[n - 1] - 2) + p[n - 1] + 1
    else:
        return p[n]


ans = rec(N, X)
print(ans)


Measured memory_bytes: 63980
#include <stdio.h>

int lenearSearch(int *, int);
int n, q;

int main(){

  int i, count=0;
  int S[10000], T[500];

  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &S[i]);
  }

  scanf("%d", &q);
  for(i=0; i<q; i++){
    scanf("%d", &T[i]);
    if(lenearSearch(S, T[i]) == 1) count++;
  }

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

  return 0;
}

int lenearSearch(int *A, int key){
  int i=0;

  A[n] = key;

  while(A[i] != key) i++;
  if(i == n)
    return 0;
  return 1;
}

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

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

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    ll n,a,b;
    cin>>n>>a>>b;

    ll full = n/(a+b);
    ll rem = n%(a+b);

    ll ans = full*a + min( rem, a );
    cout<<ans,nl;


    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


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

int main(){
    int n,x;
    int i = 0; 
    cin >> n >> x;
    int d=0,cnt=0;
    vector<int> l(n+1);
    l.at(0)=0;
    for(int i=1;i<=n;i++){
        cin >> l.at(i);
    }
    bool can = true;
    for(i=0;i<=n;i++){
        d += l.at(i);
        if(d<=x){
           cnt++; 
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int x;
int i=1;
main(){
   
   while(1){
   scanf("%d",&x);
  
  
  
   if(x==0){
    break;
   }
   
   else{
    printf("Case %d: %d\n",i,x);
   i++;
   }
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <unordered_map>
#include <string>
using namespace std;

unordered_map <string,int> Hash;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    while(n--)
    {
        string temp,str;
        cin >> temp >> str;
        if(temp=="insert")
            Hash[str]++;
        else if(temp=="find")
        {
            if(Hash[str])
                cout << "yes" << endl;
            else
                cout << "no" << endl;
        }
    }
    return 0;
}

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

int main() {
    // input
    int N, A[110];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    
    for (int i = 1; i < N; i++) {
        
        // print loop
        for (int e = 0; e < N; e++) {
            if (e > 0) cout << " ";
            cout << A[e];
        }
        cout << endl;
        
        // sorting algorithm    
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
    }
    
    // result array output
    for (int e = 0; e < N; e++) {
        if (e > 0) cout << " ";
        cout << A[e];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3068
N = int(input())
H = list(map(int, input().split()))
Hl = len(H)
can_move_list = [0 for i in range(Hl+1)]
bf = 10**9+1
for i, h in enumerate(reversed(H)):
    if bf <= h:
        can_move_list[Hl-i-1] += can_move_list[Hl-i] + 1
    else:
        can_move_list[Hl-i-1] = 0
    bf = h
print(max(can_move_list))

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

using namespace std;

//#define cin fi
//#define cout fo

//ifstream fi ("");
//ofstream fo (".INP");

int main(){
//	freopen("test.txt" , "r" , stdin);
//	ios_base:: sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	
	string s, t;
	cin >>s >> t;
	int n = s.length(), m= t.length();
	int res = INT_MAX;
	for (int i = 0 ; i <= n - m ; i++){
		int dem = 0;
		for (long long j = i ; j < i+m ; j++){
			if (t[j-i] == s[j]) dem++;
//			cout << s[j];
		}
		res = min (res, m-dem);
//		cout << "\n";
	}	
	cout << res;
	return 0;
}


Measured memory_bytes: 3640
//#pragma warning(disable:4996)
//#include <Windows.h>
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

template<class T>
inline void chmin(T& a, T b) {
	a = min(a, b);
}

template<class T>
inline void chmax(T& a, T b) {
	a = max(a, b);
}

void input();
void solve();

void daminput();

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	input();
	//daminput();
	solve();
	return 0;
}

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

int N,M;
VI A, B;

void input() {
	cin >> N >> M;
	A.resize(M);
	B.resize(M);
	for (int n = 0; n < M; n++)
	{
		cin >> A[n] >> B[n];
	}
}

void daminput() {
}

VVI G;

void solve() {
	G.resize(N);
	for (int m = 0; m < M; m++)
	{
		G[A[m] - 1].push_back(B[m] - 1);
		G[B[m] - 1].push_back(A[m] - 1);
	}
	for (int n = 0; n < N; n++)
	{
		cout << G[n].size() << "\n";
	}
}

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

signed main(){
	int N, K, X, Y;
	scanf("%d%d%d%d", &N, &K, &X, &Y);
	if(N <= K){
		printf("%d\n", X * N);
	}
	else{
		printf("%d\n", X * K + Y * (N - K));
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;
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;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";

int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, k;
    cin >> n >> k;

    vector<int> snuke(n, 1);
    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++)
        {
            int a;
            cin >> a;
            a--;
            snuke[a] = 0;
        }
    }
    cout << accumulate(snuke.begin(), snuke.end(), 0) << "\n";

    return 0;
}


Measured memory_bytes: 3608
# require 'byebug'

n, w = gets.strip.split.map(&:to_i)
vws = readlines.map {|line| line.strip.split.map(&:to_i) }

dp = Array.new(w+1, 0)

n.times do |i|
  cv, cw = vws[i]

  (0..w).to_a.reverse.each do |after_w|

    if after_w < cw
    else
      # p [dp[after_w], dp[after_w - cw] + cv]
      dp[after_w] = [dp[after_w], dp[after_w - cw] + cv].max
      # p dp
    end
  end
end

# p dp
p dp.max



Measured memory_bytes: 22980
S = input()
a = S[0]

if len(set(S))==1:
	print(len(S)//2)
	exit()

cnt=0
for i in range(len(S)):
	if i % 2 ==0:
		if S[i]!=a:
			cnt +=1
	if i % 2 ==1:
		if S[i]==a:
			cnt +=1
tmp=0
for i in range(len(S)):
	if i % 2 ==1:
		if S[i]!=a:
			tmp +=1
	if i % 2 ==0:
		if S[i]==a:
			tmp +=1
print(min(tmp,cnt))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1e9 + 7;
ll big(ll b, ll p){
	if (p == 1) return b;
	ll h = big(b, p / 2);
	ll r = h * h % mod;
	if (p % 2 == 1) r = r * b % mod;
	return r;
}
int main(){
	ll n;
	scanf("%lld", &n);
	printf("%lld\n", (big(10, n) - big(9, n) * 2 + big(8, n) + mod * 10) % mod);
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  int two = 0,one = 0,zero = 0;
  rep(i,n){
    if(a[i]%4 == 0) two ++;
    else if(a[i]%2 == 0) one ++;
    else zero ++;
  }
  bool ans ;
  if(one == 0){
    if(two+1 < zero ) ans = false;
    else ans = true;
  }else{
    int rest = n - one ;
    if(rest%2 == 0){
      if(two < zero) ans = false;
      else ans = true;
    }else{
      if(two < zero+1 ) ans = false;
      else ans = true;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}
 

Measured memory_bytes: 640
x = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))

y = 100
a = 1
while True:
    y = int(y*1.01)
    if y >= x:
        #print(y,x)
        print(a)
        exit()
    a += 1


Measured memory_bytes: 9188
N, X, Y = map(int, input().split())
X -= 1
Y -= 1


count = [0] * N
for i in range(N-1):
  for j in range(i + 1, N):
    count[min( j - i, abs(X - i) + 1 + abs(Y - j) )] += 1

for i in range(1, N):
  print(count[i])


Measured memory_bytes: 46044
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string.h>
using namespace std;

int main(void){
	char s[11], oStr[11];
	int cnt = 0;

	scanf("%s", s);

	for (int i = 0; i < 11; i++){
		if (s[i] == 'B' && cnt != 0){
			cnt--;
		}
		else if (s[i] != 'B'){
			oStr[cnt] = s[i];
			cnt++;
		}
	}
	oStr[cnt] = '\0';

	cout << oStr << endl;

	return 0;
}

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

int main()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	if(a>=k)
	{
		ans+=k;
		cout<<ans<<endl;
		return 0;
	}
	ans+=a;
	k-=a;
	if(b>=k)
	{
		cout<<ans<<endl;
		return 0;
	}
	k-=b;
	ans-=k;
	cout<<ans<<endl;	
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const long long INF = 1LL << 60;
const ll C = 1000000000+7;

int main() {
    int N, K;
    cin >> N >> K;
    int count = 1;
    N -= K;
    while(N > 0) {
        N -= (K-1);
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3564
sum[3<<17],cnt[3<<17],ans[3<<17];
N,i,acc,t,A;
main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%d",&A);
		++sum[cnt[A]++];
	}
	i=0;
	for(t=N;t>0;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		ans[t]=i-1;
	}
	for(i=1;i<=N;i++)printf("%d\n",ans[i]);
}

Measured memory_bytes: 4480
n = int(input())
p = list(map(int, input().split()))

count = 0
for i in range(n-1):
    if i+1 == p[i]:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1

if p[-1] == n:
    count += 1

print(count)


Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define prin(a) cout<<a<<"\n"
#define kaigyo cout<<"\n"
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define SORT(V) sort(ALL(V))
#define REV(V) reverse(ALL(V))
#define RSORT(V) SORT(V);REV(V)

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<string> vst;
typedef vector<char> vc;
typedef vector<long double> vd;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
typedef vector<vector<int>> vint2;
ll mod=1e9+7;

const double pi=acos(-1.0);
const ll inf=1LL<<60;
ll gcd(ll p,ll q){if(q==0)return p;return gcd(q,p%q);}  
ll lcm(ll p,ll q){return (p*q)/gcd(p,q);}
ll kaizyo(ll k){ll sum=1;rep1(i,k){sum*=i;sum%=mod;}return sum;}
ll ncr(ll n,ll r){return kaizyo(n)/(kaizyo(r)*kaizyo(n-r));}


int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
cout.precision(20);

  int x;cin>>x;
  cout<<((x>=30)?"Yes":"No");


}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main() {

int a,b[100],c[100];
   cin >> a;

for (int i = 0; i < a; ++i) 
cin >> b[i];
for(int i=0;i<a;++i)
  cin >> c[i];
int d = 0;
  
  for(int i=0;i<a;i++){
    if(b[i]>=c[i]){
      d+= b[i]-c[i];
    }
  }
  
  cout << d << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 100005
#define ll long long
using namespace std;
const int N = 1e5 + 7;
int a[N];
int main()
{
    int a, b;
    cin >> a >> b;
    int c = max(a+b, a-b);
    int ans = max(c, a*b);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pll pair<ll,ll>
#define fr first
#define se second
const ll mod = 998244353;

void solve(ll cas){
    ll n,k;cin>>n>>k;
    vector<pll> v(k);
    for(ll i=0;i<k;i++){
        cin>>v[i].fr>>v[i].se;
    }
    sort(v.begin(),v.end());
    vector<ll> dp(n+5);
    ll curr=0;
    dp[1]=1,dp[2]=-1;
    for(ll i=1;i<=n;i++){
        curr = (curr + dp[i])%mod;
        if(i==n){
            cout<<(curr+mod)%mod<<endl;
            return;
        }
        for(ll j=0;j<k;j++){
            if(i+v[j].fr<=n+1)
                dp[i+v[j].fr] = (dp[i+v[j].fr]+curr)%mod;
            if(i+v[j].se+1<=n+1)
                dp[i+v[j].se+1] = (dp[i+v[j].se+1]-curr)%mod;
        }
        // cout<<dp[i]<<' ';
    }
    // cout<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll qu=1;
    // cin>>qu;
    for(ll cas=1;cas<=qu;cas++){
        solve(cas);
    }
}


Measured memory_bytes: 4776
using System;
using static System.Console;
using System.Linq;

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
         int[] data = ReadLine().Split(' ').Select(int.Parse).ToArray();
         int ans = 0;
         for(int i = data[0]; i <= data[1]; i++){
             if(i % data[2] == 0) ans++;
         }
         WriteLine(ans);
      }
   }
}

Measured memory_bytes: 28232
import sys, queue, math, copy, itertools, bisect, collections, heapq
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
_LI = lambda: [int(x) - 1 for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())

N, M = LI()
bridge = [_LI() for _ in range(M)]

g = [i for i in range(N)]
g_num = [1 for _ in range(N)]

def find(node):
    if g[node] == node: return node
    g[node] = find(g[node])
    return g[node]

def union(x,y):
#    if find(x) == find(y) : return
    if g_num[g[x]] > g_num[g[y]]: x,y = y,x
    g_num[g[y]] += g_num[g[x]]
    g[g[x]] = g[y]

benri = [0] * M
for i in range(M-1,-1,-1):
    x, y = bridge[i]
    if find(x) == find(y): continue
    benri[i] = g_num[g[x]] * g_num[g[y]]
    union(x,y)
ans = 0
for b in benri:
    ans += b
    print (ans)


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

int main() {int N,i;
int a[100];
int c=0;
cin>>N;
if(N>=1)
{

for(i=0 ; i<N ; i++)
{cin>>a[i];

if (a[i]<=100 && a[i]%2!=0 && i%2==0)
{c++;}}
cout<<c<<endl;}

    return 0;
}


Measured memory_bytes: 3572
#include<stdio.h>
int main(void)
{
	int n,i,a,f=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(a%2==0){
			if(a%3!=0&&a%5!=0){
				f=1;
			}
		}
	}
	if(f==1){
		printf("DENIED\n");
	}
	else{
		printf("APPROVED\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int main() {
  ll n;
  ll m;
  cin >> n;
  for(ll i=1; i*i<=n; i++){
  	if(n%i==0){
    	m=max(i,m);
    }
  }
  cout << m+n/m-2 << endl;
}




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

int div(int a){
    int count = 0;
    while (a%2 == 0){
        a /= 2;
        count++;
    }
    return count;
}

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

    int ans = 0;
    for (int i = 0; i<n; i++){
        int a;
        cin >> a;
        ans += div(a);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define rrep(i, n) for (i = n; i >= 0; i--)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)

#define O 1
#define X 0
#define S 1
#define W 0

int next(int p, int c, int a) {
    if (c == S) return a ? p : !p;
    if (c == W) return a ? !p : p;
}

int collect(int p, int c, int n, int a) {
    if (c == S) return a ? p == n : p != n;
    if (c == W) return a ? p != n : p == n;
}

int main() {
    static int n, s[114514], i, j;
    scanf("%d", &n);
    getchar();
    rep(i, n) s[i] = getchar() == 'o' ? O : X;

    static int p[4][114514] = { { S, S }, { S, W }, { W, S }, { W, W } };
    rep(i, 4) rep(j, n) {
        if (j < 2) continue;
        p[i][j] = next(p[i][j - 2], p[i][j - 1], s[j - 1]);
    }

    rep(i, 4) {
        if (collect(p[i][n - 1], p[i][0], p[i][1], s[0]) &&
            collect(p[i][n - 2], p[i][n - 1], p[i][0], s[n - 1])) {
            rep(j, n) putchar(p[i][j] ? 'S' : 'W');
            printf("\n");
            return 0;
        }
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
 
int main(void){
    int a,b,c,d;
    cin>>a>>b;
    c=a-b;
    d=0;
    
   while(1){
   	if(c>0){
   		d++;
   		c=c-b;
   	}else{
   		d++;
   		break;
   	}
   	}
   	cout<<d;
     
    return 0;
}

Measured memory_bytes: 256
a[6],x;main(i,j){for(;~j;++i)i<6?x|=1<<(scanf("%d",&j),a[i]=--j):i>10?x=i=0:printf("%d\n",x-(x&-x)&&x-7?j=a[i-5],x&2?x&1?j+1:j:j?1:2:3);}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<char> D(N);
    vector<int> L(N);
    vector<pair<int, int>> p;
    for (int i = 0; i < N; i++) {
        cin >> D[i] >> L[i];
        if (D[i] == 'y') {
            p.emplace_back(L[i], i);
        }        
    }
    
    sort(p.begin(), p.end());
    
    int res = 0;
    vector<bool> rem(N);
    for (const auto c : p) {
        int i = c.second;
        if (rem[i]) continue;
        rem[i] = 1;
        ++res;
        for (int j = i + 1; j < N; j++) {
            if (D[j] == 'y') {
                rem[j] = 1;
            } else if (L[i] <= L[j]) {
                break;
            }
        }
        for (int j = i - 1; j >= 0; j--) {
            if (D[j] == 'y') {
                rem[j] = 1;
            } else if (L[i] <= L[j]) {
                break;
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3140
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin>>n;
  
  int ans=0,x;
  rep(i,n){
    cin>>x;
    ans+=x-1;
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include <iterator>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<cstdint>
#include<chrono>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

using namespace std;



signed main() {

	int N, M;
	cin >> N >> M;
	vector<int>A(N);
	rep(i, N)cin >> A[i];
	priority_queue<int>Q;
	rep(i, N)Q.push(A[i]);
	rep(i, M) {
		int x = Q.top();
		Q.pop();
		Q.push(x / 2);
	}
	int answer = 0;
	rep(i, N) {
		int x = Q.top();
		Q.pop();
		answer += x;
	}
	cout << answer << endl;

	return 0;
}

Measured memory_bytes: 2168
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;
    while(true){
        cin>>n;
        if(n==0)break;
        vector<int> v(n);
        int sum=0;
        rep(i,n){
            cin>>v[i];
            sum+=v[i];
        }
        sort(v.begin(),v.end());
        sum-=v[0];
        sum-=v[n-1];
        int ave=sum/(n-2);
        cout<<ave<<endl;


    }

    return 0;
}



Measured memory_bytes: 3036
#include<stdio.h>
#define N 100000

int n,A[N];

int partition(int p,int r){
  int i,j,t,x;
  x = A[r];
  j = p-1;
  for(i=0;i<r;i++){
    if(A[i]<=A[r]){
      j++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[j+1];
  A[j+1] = A[r];
  A[r] = t;

  return j+1;
}
int main(){
  int i,q;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  q = partition(0,n-1);

  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    if(i == q) printf("[");
    printf("%d",A[i]);
    if(i == q) printf("]");
  }
  printf("\n");


  return 0;
}



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


int main()
{
	string O,E;
	string answer="";
	cin	>> O >> E;

	for (int i = 0; i < E.size(); ++i) {
		answer = answer + O[i] + E[i];
	}

	if (O.size() > E.size()) {
		answer = answer + O[O.size() - 1];
	}

		cout << answer << endl;


	
	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#define abs(a) (((a)>0)?(a):(-a))
int main() {
	int n, a[100010];
	long sum = 0;
	scanf("%d", &n);
	a[0] = 0; a[n + 1] = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
		sum += abs((a[i] - a[i - 1]));
	}
	sum += abs((a[n + 1] - a[n]));
	for (int i = 1; i <= n; i++)
	{
		printf("%d\n", sum - abs((a[i] - a[i - 1])) - abs((a[i + 1] - a[i])) + abs((a[i + 1] - a[i - 1])));
	}
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
    ll X,K,D;
    cin >> X >> K >> D;

    X = abs(X);
    ll c = X/D;

    ll d = X - D*c;
    ll ans;
    if(c >= K){
        ans = X-K*D;
    }else if((K-c)%2 == 0){
        ans = d;
    }else{
        ans = abs(d-D);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3656
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
#define MK make_pair
const ll E=1e17+7;
const ll MOD=1000000007;




int main(){
    ll mx=0;
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll count=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='I'){count++;}
        if(s[i]=='D'){count--;}
        mx=max(mx,count);
    }
    cout<<mx<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
using namespace std ;

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=a;i<b;i++)
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e9
#define endl "\n"

ll power(ll b,ll e,ll m)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b%m,(e-1)/2,m)%m;
	else
		return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int h,w,n;
	cin>>h>>w>>n;
	int ans=(n/max(h,w))+(n%(max(h,w))!=0);
	cout<<ans;
	return 0;
}


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

int main() {
  int N, K;
  string S;

  cin >> N >> K >> S;

  if (S[K-1] == 'A') S[K-1] = 'a';
  if (S[K-1] == 'B') S[K-1] = 'b';
  if (S[K-1] == 'C') S[K-1] = 'c';

  cout << S;
  


  


}


Measured memory_bytes: 256
A[999][1000],I[1000],u[1000];i,j;d;F=2;main(N){for(scanf("%d",&N);i<N;++i)for(j=0;j<N-1;)scanf("%d",A[j++]+i);for(;F&2;)for(F=1,i=!++d;i<N;++i)u[i]<d&I[i]<N-1&&I[F&=2,j=A[I[i]][i]-1]<N-1&&u[j]<d&A[I[j]][j]==i+1&&++I[u[i]=u[j]=d,++I[i],F=2,j];printf("%d",F*d-1);}

Measured memory_bytes: 4096
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    int c = scanner.nextInt();
    int x = scanner.nextInt();

    int cnt = 0;
    for (int i = 0; i <= a && 500 * i <= x; i++) {
      for (int j = 0; j <= b && 100 * j <= x - 500 * i; j++) {
        int rem = x - 500 * i - 100 * j;
        if (rem >= 0 && rem / 50 <= c) cnt++;
      }
    }
    System.out.println(cnt);
  }
}


Measured memory_bytes: 22612
import java.io.File

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main(args: Array<String>) {
    val (k, n) = readInts()
    var a = readInts()

    // 最大の間隔を調べる
    var maxd = 0
    var maxi = 0
    var last = a.last() - k

    a.forEachIndexed { index, i ->
        val d = i - last
        if (d > maxd) {
            maxd = d
            maxi = index
        }
        last = i
    }

    if (maxi != 0) {
        var y1 = a[maxi - 1]
        var y2 = k - a[maxi]
        println(y1 + y2)
    } else {
        println(a.last() - a.first())
    }
}


Measured memory_bytes: 83876
#include <iostream>

using namespace std;

int main(void) {
	int h,N,K;
	cin >> N >> K;
	int res = 0;
	for (int i = 0; i < N; ++i) {
		cin >> h;
		if (h >= K) {
			++res;
		}
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define print(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define pii pair<int,int> 
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define X first
#define Y second
#define oset tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int mod = 998244353, x = 864197532, N = 100000;

int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, tmp, ttmp;
	cin >> n >> k;
	vector <bool> is(n, false);
	fop (i,0,n) {
		cin >> tmp;
		fop (j,0,tmp) cin >> ttmp, is[ttmp - 1] = true;
	}
	int c = 0;
	fop (i,0,n) {
		if (!is[i]) {
			c++;
		}
	}
	cout << c << endl;
}

Measured memory_bytes: 3660
#include<iostream>
#include <algorithm>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include <queue>
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
using namespace std;
typedef vector<vector<char>> field_t;

typedef pair<int, int> point_t;



int main()
{
    int N,Y,i,M;
    cin >> N >> M;
	vector<int> A(M);
	rep(i,M){
    	cin>>A[i];
		N-=A[i];
    }
	if(N>=0){
    	cout<<N<<endl;
	}else{
		cout<<-1<<endl;
    }
}

Measured memory_bytes: 3664
# -*- coding: utf-8 -*-


def maximum_profit(profits):
    max_v = profits[1] - profits[0]
    min_v = profits[0]

    for j in range(1, len(profits)):
        max_v = max(max_v, profits[j]-min_v)
        min_v = min(min_v, profits[j])

    print(max_v)


def to_int(v):
    return int(v)


if __name__ == '__main__':
    l = to_int(input())
    profits = [to_int(input()) for i in range(l)]

    maximum_profit(profits)

Measured memory_bytes: 15648
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll L, R, d;
  cin >> L >> R >> d;
  ll ans = 0;
  for (ll i = L; i <= R; ++i) {
    if (i % d == 0) {
      ans += 1;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3604
#include <stdio.h>

int main(void) {
	int i,j;
	char A[11], B[11], C[11];
	scanf("%s%s%s", &A, &B, &C);
	for (i = 0; A[i] != '\0'; i++);
	for (j = 0; B[j] != '\0'; j++);
	if (A[i - 1] == B[0] && B[j - 1] == C[0]) {
		printf("YES");
	}
	else {
		printf("NO");
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

int main() {
    
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N;
    lint C;
    cin >> N >> C;
    
    vector<lint> x(N + 1), v(N + 1);
    for (int i = 1; i <= N; i++) cin >> x[i] >> v[i];
    
    vector<lint> cw(N + 1), Midx(N + 1), ccw(N + 1);
    lint sum = 0;
    for (int i = 1; i <= N; i++) {
        sum += v[i];
        cw[i] = sum - x[i];
    }
    for (int i = 1; i <= N; i++) {
        if (cw[i] <= cw[i - 1]) {
            cw[i] = cw[i - 1];
            Midx[i] = Midx[i - 1];
        }
        else { Midx[i] = x[i]; }
    }
    
    sum = 0;
    for (int i = N; i > 0; i--) {
        sum += v[i];
        ccw[i] = sum - (C - x[i]);
    }
    
    lint ans = cw[N];
    for (int i = 1; i <= N; i++) {
        ans = max({ ans, cw[i - 1] + ccw[i] - (C - x[i]), ccw[i] });
    }
    sum = 0;
    for (int i = 1; i <= N; i++) {
        sum += v[i];
        cw[i] = sum - x[i] * 2;
    }
    for (int i = 1; i <= N; i++) {
        if (cw[i] <= cw[i - 1]) {
            cw[i] = cw[i - 1];
            Midx[i] = Midx[i - 1];
        }
        else { Midx[i] = x[i]; }
    }
    for(int i = 1; i <= N; i++) {
        ans = max(ans, cw[i - 1] + ccw[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main(){
	string s, t;
	cin >> s >> t;
	bool flag= true;
	for(int i = 0; i < (int)s.size(); i++)
		if(s[i] != t[i]) flag = false;
	printf("%s\n", (flag) ? "Yes" : "No");
}


Measured memory_bytes: 3640
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        HashSet<String> hs = new HashSet<String>();
        for(int i=0;i<a;i++){
            hs.add(scan.next());
        }
        System.out.println(hs.size());
    }
}


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



int main() {
   int n,k,q;
   cin>>n>>k>>q;
   int p[101010]={};
   for(int i=0;i<q;i++){
      int a;
      cin>>a;
      p[a-1]++;
   }
   for(int i=0;i<n;i++){
      if(q-p[i]>=k)cout<<"No"<<endl;
      else cout<<"Yes"<<endl;
   }

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

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

    REP(i, 100) {
        if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
            cout << i << endl;
            return 0;
        }

        a = B / 2 + C / 2;
        b = A / 2 + C / 2;
        c = A / 2 + B / 2;
        A = a;
        B = b;
        C = c;
    }

    cout << -1 << endl;
}

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

using matrix = vector<vector<int>>;

void matmul_assign(matrix& A, const matrix& B, int mod) {
    int N = int(A.size());
    matrix C(N, vector<int>(N));
    rep(k, N) rep(i, N) rep(j, N) {
        if ((C[i][j] += (long long)A[i][k] * B[k][j] % mod) >= mod) C[i][j] -= mod;
    }
    A.swap(C);
}

void matpow_assign(matrix& A, int e, int mod) {
    int N = int(A.size());
    matrix B(N, vector<int>(N));
    rep(i, N) B[i][i] = 1;
    for (; e > 0; e >>= 1, matmul_assign(A, A, mod)) if (e & 1) matmul_assign(B, A, mod);
    A.swap(B);
}

int main() {
    for (int N, M, A, B, C, T;
         cin >> N >> M >> A >> B >> C >> T, N | M | A | B | C | T;) {
        vector<int> S(N);
        for (int& e : S) cin >> e;
        matrix R(N, vector<int>(N));
        rep(i, N) {
            if (i > 0) R[i][i - 1] = A;
            R[i][i] = B;
            if (i < N - 1) R[i][i + 1] = C;
        }
        matpow_assign(R, T, M);
        rep(i, N) {
            if (i) cout << ' ';
            int s = 0;
            rep(j, N) if ((s += (long long)R[i][j] * S[j] % M) >= M) s -= M;
            cout << s;
        }
        cout << endl;
    }
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n; cin >> n;
    int ans = 1000 - n % 1000;
    if(n % 1000 == 0) ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 3632
S = gets.chomp
K = gets.chomp.to_i
N = S.length



# DPの配列の大きさは+1にしておく
# dp = Array.new(digit+1).map{Array.new(k+1).map{Array.new(2,0)}}

# ややこしいので静的にサイズを決めておく
# 桁数101 非ゼロの数4
dp = Array.new(N+1).map{Array.new(4).map{Array.new(2,0)}}

# i = 0何も決めていない状態で
# j = 0 非ゼロ（1以上の数が）が0個で
# k = 0 何も決めていない状態なので一致しているので0として良い 空集合が一致
dp[0][0][0] = 1


N.times do |i| #n桁
  (K+1).times do |j| #0~3個なので +1
    2.times do |k| #一致していれば0 してなければ1

      # 今の桁の値
      nd = S[i].to_i

      # 0~9のどれにするか
      10.times do |d|
        # 次の数字
        ni = i + 1
        nj = j
        nk = k

        nj += 1 if d != 0
        next if nj > K

        # 一致してるとき
        if k == 0
          next if d > nd
          nk = 1if d < nd
        end

        dp[ni][nj][nk] += dp[i][j][k]

      end
    end
  end
end

p dp[N][K][0] + dp[N][K][1]

# dp[ 決めた桁数 ][ 未満フラグ ] := 総数

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

#define ll long long

using namespace std;

int n, w;
ll dp[(int)1e5 + 7];

main() {
	scanf("%d %d", &n, &w);
	for (int i = 0; i <= (int)1e5; i++) {
		dp[i] = 1e18;
	}
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		for (int i = (int)1e5; i >= b; i--) {
			dp[i] = min(dp[i], dp[i - b] + a);
		}
	}
	int ans = 0;
	for (int i = 0; i <= (int)1e5; i++) {
		if (dp[i] <= w) {
			ans = i;
		}
	}
	cout << ans;
}


Measured memory_bytes: 1024