akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#define N 200
#define MAX 200
int top;
int S[MAX];
void initialize();
int isEmpty();
int isFull();
void push(int x);
int pop();

int main()
{
  int i,num,l,k;
  char n[N];
  
  initialize();
  while((scanf("%s",n)) != EOF){
    //printf("%d\n", S[top]);
    if(n[0] == '+'){
      l = pop();
      k = pop();
      push(l + k);
    }
    else if(n[0] == '-'){
      l = pop();
      k = pop();
      push(k -l);
    }
    else if(n[0] == '*'){
      l = pop();
      k = pop();
      push(l * k);
    }
    else{
      num = atoi(n);
      if(num >= 1000000) continue;
      push(num);
    }
  }
  printf("%d\n",pop());
  return 0;
}

void initialize(){
  top = 0;
}
int isEmpty(){
  if(top == 0){
  return -1;
  }
  return 0;
}
int isFull(){
  if(top >= MAX -1){
  return -1;
  }
  return 0;
}
void push(int x){
  if(isFull() == -1){
    printf("Error\n");
  }
  top++;
  S[top] = x;
}
int pop(){
  if(isEmpty() == -1){
    printf("Error\n");
  }
  top--;
  return S[top+1];  
}



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

using namespace std;

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, k;
    cin >> n >> k;
    if (n <= 0LL) cout << n;
    else cout << (n % k <= k - (n % k) ? n % k : k - (n % k));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    rep(i, s.size() - 1) {
        if(s[i] != s[i + 1]) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    a = toupper(a[0]);
    b = toupper(b[0]);
    c = toupper(c[0]);
    cout << a << b << c << endl;
}

Measured memory_bytes: 256
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        k = bisect.bisect_left(L, L[i]+L[j])
        ans += max(0, k-j-1)
print(ans)

Measured memory_bytes: 3188
#include<cstdio>
#include<cmath>
#include<math.h> 
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
double t,tang,pans,ans,pi=3.14159265358979323846;
int a,b,x,v;
int main()
{
	scanf("%d%d%d",&a,&b,&x);
	v=a*a*b;
	if(x>=v/2)
	{
		t=(double)(2*v-2*x)/(a*a);
		tang=(double)t/a;
		pans=atan(tang);
		ans=(double)pans*180/pi;
	}
	else if(x<v/2)
	{

		t=(double)2*x/(a*b);
		tang=(double)b/t;
		pans=atan(tang);
		ans=(double)pans*180/pi;
	}
	printf("%.10lf\n",ans);
	return 0;
}


Measured memory_bytes: 512
N,H=map(int,input().split())
A=[]
B=[]
for i in range(N):
    AB=list(map(int,input().split()))
    A.append(AB[0])
    B.append(AB[1])

B.sort(reverse=True)
Amax=max(A)
ans=0

for i in range(N):
    if B[i]<Amax:
        break

    H-=B[i]
    ans+=1
    if H<=0:
        break

if H>0:
    ans=ans+(-(-H//Amax))

print(ans)

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

int abs(int a ,int b){
    if(a > b) return a-b;
    else return b-a;
}

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    int ad = abs(x, a);
    int bd = abs(x, b);

    if(ad < bd) cout << "A" << endl;
    else cout << "B" << endl;
}

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

int main() {
  int N, K;
  int D = 1;
  cin >> N >> K;
  
  for (int i = 0; i < N; ++i) {
    if (D < K) {
      D *= 2;
    } else {
      D += K;
    }
  }
  
  cout << D << endl;
}

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

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String nl = System.getProperty("line.separator");
		StringBuilder p = new StringBuilder();
		Scanner r = new Scanner(System.in);
		int h, w, i, j;
		while ((h = r.nextInt()) + (w = r.nextInt()) > 0) {
			for (i = h; i > 0; --i) {
				for (j = w; j > 0; --j) {
					if ((i == h)||(j == w)||(j == 1)||(i == 1)) {
						p.append('#');
					} else {
						p.append('.');
					}
				}
				p.append(nl);
			}
			p.append(nl);
		}
		System.out.print(p);
	}
}

Measured memory_bytes: 20148
#include <stdio.h>
#include <ctype.h>
int main(void)
{
	char ch;
//	while(ch = fgetc(stdin), ch != '\n') {
//		if (isalpha(ch)) ch = isupper(ch) ? tolower(ch) : toupper(ch);
//		fputc(ch, stdout);
//	}

	do {
		ch = fgetc(stdin);
		if (isalpha(ch)) ch = isupper(ch) ? tolower(ch) : toupper(ch);
		fputc(ch, stdout);
	} while (ch != '\n');
	
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    bool ans=false;
    sort(s.begin(),s.end());
    bool judge = s[0]==s[1] && s[2]==s[3] && s[1]!=s[2];
    if(judge) ans=true;
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import math
from decimal import *
getcontext().prec = 28
a,b=map(str, input().split())
a_ = Decimal(a)
b_ = Decimal(b)
#b = b*100
#print(round(Decimal(Decimal(a)*Decimal(b))))
print(math.floor(a_*b_))
#print(math.floor(Decimal(a)*Decimal(b)/Decimal(100.0)))

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

const int size = 2e5;
vector<int> graph[size+1];
int nodeValue[size+1];
bool vis[size+1];

void dfs(int node){
  	vis[node] = true;
  	for(int i=0;i<graph[node].size();i++){
  	    if(!vis[graph[node][i]]){
  		    nodeValue[graph[node][i]]+=nodeValue[node];
		    dfs(graph[node][i]);
  	    }
	}
}

int main(){
	
  	int n,q; cin >> n >> q;
  
  	for(int i=1;i<=n-1;i++){
    	int a,b; cin >> a >> b;
      	graph[a].push_back(b);
      	graph[b].push_back(a);
    }
  	
  	for(int i=1;i<=q;i++){
      int node,value; cin >> node >> value;
      nodeValue[node]+=value;
    }
  
  	dfs(1);
  	
  	for(int i=1;i<=n;i++) cout << nodeValue[i] << " ";

	return 0;
}

Measured memory_bytes: 23680
#include "bits/stdc++.h"
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long long LL;
#define REP(i,N) for (int i=0; i<N; i++)

int main() {
  int a, b, c, ans;
  cin >> a >> b >> c;
  ans = min(a + b, b + c);
  ans = min(ans, c + a);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int L,R,d;
    cin>>L>>R>>d;

    cout << R/d-(L-1)/d    <<endl;

    



}


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

int main() {
  int N, X;
  cin >> N >> X;
  int m[110];
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> m[i];
    sum += m[i];
  }
  sort(m, m + N);
  int min = (X - sum) / m[0];
  cout << N + min << endl;
}

Measured memory_bytes: 256
//██████╗ ██╗   ██╗██╗      ██████╗ ███████╗
//██╔══██╗██║   ██║██║      ██╔══██╗██╔════╝
//██████╔╝██║   ██║██║█████╗██║  ██║█████╗
//██╔══██╗██║   ██║██║╚════╝██║  ██║██╔══╝
//██║  ██║╚██████╔╝██║      ██████╔╝███████╗
//╚═╝  ╚═╝ ╚═════╝ ╚═╝      ╚═════╝ ╚══════╝
#include <iostream>
#include <random>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
#include <chrono>
#include <cstdio>


// #pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define sqr(x) ((x) * (x))

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;

#define next ajksdslk
#define prev aklsfjk

mt19937_64 mt_rand(chrono::system_clock::now().time_since_epoch().count());

template<typename T1, typename T2> inline bool upmax(T1& a, T2 b) { return (a < b ? (a = b, true) : false); }
template<typename T1, typename T2> inline bool upmin(T1& a, T2 b) { return (b < a ? (a = b, true) : false); }

const int maxn = (int) 5e6 + 100;
const int maxlog = 21;
const int base = 1e9 + 7;
const ld eps = (ld) 1e-9;
const ld PI = acos(-1.);
//const int pp = 41;
const int inf = 2e9;
const ll llinf = 1e18;

int f[6333];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#ifdef LOCAL
  freopen ("input.txt", "r", stdin);
#endif

  int n, T;
  cin >> n >> T;
  vector<pii> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(all(a));

  for (int i = 0; i < n; i ++) {
    int x, y; tie(x, y) = a[i];

    for (int t = T - 1; t >= 0; t --) {
      upmax(f[t + x], f[t] + y);
    }
  }
  int ans = 0;
  for (int i = 0; i < 6333; i ++) {
    upmax(ans, f[i]);
  }
  cout << ans << '\n';
  return 0;
}

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

int main(){
  int n;
  while(cin >> n, n){
    int w[n];
    for(int i = 0; i < n; ++i)
      cin >> w[i];
    
    int dp[n][n];
    for(int i = 0; i < n; ++i){
      fill(dp[i],dp[i]+n,0);
    }
    
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){
	if(j+i+1 > n-1) break;
	if(dp[j+1][j+i] == i && abs(w[j]-w[j+i+1]) < 2){
	  dp[j][j+i+1] = dp[j+1][j+i] + 2;
	}else{
	  for(int k = 0; k <= i; ++k){
	    dp[j][j+i+1] = max(dp[j][j+i+1],dp[j][j+k]+dp[j+k+1][j+i+1]);
	  }
	}
      }
    }
    //Debug
    /*
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){
      cout << dp[i][j] << " ";
      }
      cout << endl;
    }

    */
    cout << dp[0][n-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 3416
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--)
#define Rep(i,a) for(int i = 0; i < a; i ++)
using namespace std;
const int N = 4e4 + 10, mod = 998244353;
int n, f[N], fac[N], inv[N], s[N], L;
char a[N], b[N];
int C(int n, int m) {
	return fac[n] * 1LL * inv[n - m] % mod * inv[m] % mod;
}
int pw(int a, int b) { 
	int w = 1; for(;b;b >>= 1, a = 1LL * a * a % mod) if (b & 1) w = 1LL * w * a % mod;
	return w; 
}


int rev[N], w[2][N];
void nttinit(int &n){
	int m = 1, l = 0;
	while (m < n) m <<= 1, l++;
	n = m;
	rep(i,1,n - 1) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (l - 1));
	w[1][n] = pw(3, (mod - 1) >> l);
	dep(i,l - 1,1) w[1][1 << i] = (1LL * w[1][1 << (i + 1)] * w[1][1 << (i + 1)]) % mod;
	w[0][n] = pw(w[1][n], mod - 2);
	dep(i,l - 1,1) w[0][1 << i] = (1LL * w[0][1 << (i + 1)] * w[0][1 << (i + 1)]) % mod;
}
void fft(int *a, int l, int f){
	if (f == -1) f = 0;
	Rep(i,l) if (rev[i] < i) swap(a[i], a[rev[i]]);
	for(int n = 2; n <= l; n <<= 1){
		int mid = n >> 1, wn = w[f][n];
		for(int i = 0; i < l; i += n){
			int w = 1;
			Rep(j,mid){
				int t1 = a[i + j], t2 = 1LL * a[i + j + mid] * w % mod;
				a[i + j] = (t1 + t2) % mod;
				a[i + j + mid] = (t1 - t2) % mod;
				w = 1LL * w * wn % mod;
			}
		}
	}
	int invl = pw(l, mod - 2);
	if (!f) Rep(i,l) a[i] = 1LL * a[i] * invl % mod;
}

int t; 
void conv(int a[], int b[], int c[]) {
	static int ta[N], tb[N];
	Rep(i,t) ta[i] = tb[i] = 0;
	Rep(i,L) ta[i] = a[i], tb[i] = b[i];
	fft(ta, t, 1), fft(tb, t, 1);
	Rep(i,t) c[i] = 1LL * ta[i] * tb[i] % mod;
	fft(c, t, -1);
	rep(i,L,t) c[i] = 0;
}

void pw(int a[], int b, int w[]) {
	memset(w, 0, (N - 1) * sizeof(w[0])); w[0] = 1;
	for( ;b; b >>= 1, conv(a, a, a)) if (b & 1) conv(w, a, w);
}

int sc[N], g[N];
void init(int c) {
	L = n + 1; t = L * 2; nttinit(t);
	rep(i,1,n - c + 1) sc[i] = inv[i];
	pw(sc, c, g);
	rep(i,c,n) g[i] = 1LL * g[i] * fac[i] % mod;
}


int count_chain(int c, int m) {
	return g[m + c];
}

int main() {
	scanf("%s",a + 1); scanf("%s",b + 1); n = strlen(a + 1);
	fac[0] = 1; rep(i,1,n) fac[i] = 1LL * i * fac[i - 1] % mod;
	inv[n] = pw(fac[n], mod - 2); dep(i,n - 1,0) inv[i] = 1LL * inv[i + 1] * (i + 1) % mod;
	int cnt = 0; rep(i,1,n) if (a[i] != b[i]) cnt++; cnt /= 2;
	int m = 0; rep(i,1,n) if (a[i] == '1') m++; swap(n, m);
	int ans = 0;
	init(cnt);
	rep(i,0,n - cnt) {
		int rest = (n - cnt) - i;
		int cof = 1LL * C(n - cnt, i) * fac[i] % mod * fac[cnt] % mod * fac[n - cnt - i] % mod * count_chain(cnt, n - cnt - i) % mod;
		ans = (ans + 1LL * cof * fac[i] % mod * C(n, i)) % mod;
	}
	if (ans < 0) ans += mod;
	printf("%d\n",ans);
	return 0; 
}

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

using ll = long long;
const int MOD = 1000000007;
#define p(var)  std::cout<<var<<std::endl
#define pp(var) std::cout<<#var" = "<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for (int i = 0; i <  (n); i++)
#define repeq(i, n) for (int i = 1; i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline double isint(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

/*-----8<-----8<-----*/


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

    vector<ll> shiro(N+1,0),kuro(N+1,0);

    rep(i,S.size()){
        if(S[i]=='#'){
            kuro[i+1]=kuro[i]+1;
            shiro[i+1]=shiro[i];
        }else{
            shiro[i+1]=shiro[i]+1;
            kuro[i+1]=kuro[i];
        }

    }


    ll t,minval=99999999;
    rep(i,N+1){
        //....####
        t=kuro[i]+   shiro[N]-shiro[i];
        chmin(minval,t);

    }




    p(minval);
    return 0;
}



Measured memory_bytes: 3716
#include <stdio.h>

int main()
{
    int H, W;
    while (1)
    {
        scanf("%d %d", &H, &W);
        if (H == 0 && W == 0)
            break;

        for (int h = 0; h < H; h++)
        {
            for (int w = 0; w < W; w++)
            {
                if ((w + h) % 2 == 0)
                {
                    printf("#");
                }
                else
                {
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2600
x, y = map(int, input().split())

if (x+y) % 3 != 0:
    print(0)
else:
    mod = int(1e9 + 7)
    n = (2*y - x) // 3
    m = y - 2 * n
    if n < 0 or m < 0:
        print(0)
    else:
        f = [1]
        for i in range(1, n+m+1):
            f.append(f[-1] * i % mod)
        ans = f[n+m] * pow(f[n] * f[m], mod - 2, mod) % mod
        print(ans)

Measured memory_bytes: 86128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;



int main() {

    
    ll x;
    cin>>x;
    int ans=0;
    ll coin=100LL;
    while(coin<x){
        ans++;
        coin*=1.01;
    }
    fin(ans);
}



Measured memory_bytes: 3624
/// Love it~

#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
#define x1 qeerdx
#define y1 qeerdy
 
#define lb lower_bound
#define ub upper_bound
 
#define endl '\n'
#define fast_in ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
#define mp  make_pair
#define pb  push_back
 
#define fi first
#define se second
 
#define   sz(x)  (int)x.size()
#define  all(x)  x.begin(), x.end()
#define  bit(x)  __builtin_popcountll(x)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair <ll,ll> pii;
 
const int inf = (int) 1e9+99999, mod = (int)1e9+7;
const ll linf = (ll) 2e18+99999;
 
int kob (int x, int y) { return ((ll)x * y) % mod; } 
int aza (int x, int y) { x -= y; if (x < 0) return x + mod; return x; } 
int kos (int x, int y) { x += y; if (x >= mod) return x - mod; return x; }
 
const int maxn = (int)2600, maxn2 = (int) 1e6+55;
 
static long holdrand = 1L;
void srand(unsigned int seed){holdrand = (long) seed;} 
int rand() {return (((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);}

int k[maxn], a[maxn][maxn];
int b[maxn];
int p[maxn];

int main () {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i += 1) {
		cin >> k[i];
		for (int j = 1; j <= k[i]; j ++) {
			cin >> a[i][j];
		}
	}

	for (int i = 1; i <= m; i ++) {
		cin >> p[i];
	}

	int res = 0;
	for (int mask = 0; mask < (1 << n); mask ++) {
		for (int i = 0; i < n; i ++) {
			if (mask & (1 << i)) {
				b[i+1] = true;
			} else {
				b[i+1] = false;
			}         
		}
	
	    bool bad = false;
		for (int i = 1; i <= m; i ++) {
			int sum = 0;
			for (int j = 1; j <= m; j ++) {
				sum += b[a[i][j]];
			}

			if (sum % 2 != p[i]) {
				bad = true;
				break;
			}
		}
		res += (!bad);
	}

	cout << res;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6;
int a[N];
 
int main()
{
	int k, n; scanf("%d%d", &k, &n);
	long long ans = 0;
	int mx = 0;
	for (int i = 1; i <= n; ++i )
	{
		scanf("%d", &a[i]);
		ans += a[i] - a[i - 1];
		if(i - 1) mx = max(mx, a[i] - a[i - 1]);
	}
	ans += k - a[n];
	mx = max(k + a[1] - a[n], mx);
	printf("%lld\n", ans - mx);

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
long long N, A, B, R; int C, D;
int main() {
	cin >> N >> C >> D >> A >> B;
	R = (A ? (A * 100 - 1) / C + 1 : 0) + (B ? (B * 100 - 1) / D + 1 : 0);
	cout << (N - R < 0 ? -1 : N - R) << endl;
	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}
int main() {
    int d;
    cin >> d;
    vector<int> c(26); //満足度の下がりやすさ
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(d, vector<int> (26)); //満足度の増減(たてが日時、よこがコンテストの種類)
    rep(i, d) {
        rep(j, 26) cin >> s[i][j];
    }
    vector<int> ans = {6,1,8,3,10,5,12,7,14,9,16,11,18,13,20,15,22,17,24,19,26,21,23,25,2,4};
    // cout << ans.size()<< endl;
    /*rep(i, 26) ans[i] = i + 1;
    rep(i, 26) {
        swap(ans[i], ans[i + 3]);
        cout << ans[0] << endl;
        ans.erase(remove(ans.begin(), ans.end(), ans[0]), ans.end());
    }*/
    rep(i, 365) cout << ans[i % 26] << endl;
    
}

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

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

    a = n/1000;
    b = (n - a*1000)/100;
    c = (n - (a*1000 + b*100))/10;
    d = n - (a*1000 + b*100 + c*10);



    if((a==b && a==c) || (b==c && b==d) ){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }

}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int X,A,B;
  scanf("%d",&X);

  for (int i = 1; i <= X; i++)
  {
    A=i*(i-1)/2;
    B=i*(i+1)/2;
    if (A<=X&&X<=B)
    {
      printf("%d",i);
      break;
    }
  }

  return 0;
}

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

using namespace std;

int main()
{
    char a[1];
    cin >> a;

    if(a[0] == 'a' || a[0] == 'e' || a[0] == 'i' || a[0] == 'o' || a[0] == 'u')
        cout << "vowel\n";
    else
        cout << "consonant\n";

    return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long double ld;

const int MAX = 501,IINF = INT_MAX;
const ld LDINF = 1e100;
int H,W,sx,sy,gx,gy;
ld mincost[MAX][MAX][2]; // mincost[][][0] => from start, [1] = > from star
char c[MAX][MAX];
bool ban[MAX][MAX];
vector<int> star,plane;
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};

inline bool isValid(int x,int y) { return 0 <= x && x < W && 0 <= y && y < H; }

inline void bfs(vector<int> sp,vector<int> Forbidden,int type){
  rep(i,H)rep(j,W) mincost[i][j][type] = LDINF, ban[i][j] = false;
  queue<int> que;
  rep(i,(int)sp.size()) que.push(sp[i]), mincost[sp[i]/W][sp[i]%W][type] = 0;
  rep(i,(int)Forbidden.size()) ban[Forbidden[i]/W][Forbidden[i]%W] = true;

  while(!que.empty()){
    int cur = que.front(); que.pop();
    rep(i,4){
      int nx = cur % W + dx[i], ny = cur / W + dy[i];
      if( c[ny][nx] == '#' ) continue;
      if( ban[ny][nx] ) continue;
      if( mincost[ny][nx][type] == LDINF ) {
        mincost[ny][nx][type] = mincost[cur/W][cur%W][type] + 1;
        que.push(nx+ny*W);
      }
    }
  }
}

bool check(ld E){
  ld T = 0;

  rep(i,(int)plane.size()){
    int x = plane[i] % W, y = plane[i] / W;
    T += min(mincost[y][x][0],mincost[y][x][1]+E);
  }

  ld len = plane.size();
  return len * E > T;
}

int main(){
  cin >> W >> H;
  rep(i,H)rep(j,W){
    cin >> c[i][j];
    if( c[i][j] == 's' ) sx = j, sy = i, c[i][j] = '.';
    if( c[i][j] == 'g' ) gx = j, gy = i;
    if( c[i][j] == '*' ) star.push_back(j+i*W);
    if( c[i][j] == '.' ) plane.push_back(j+i*W);
  }

  vector<int> sp,forbidden;
  sp.push_back(gx+gy*W);
  forbidden = star;
  forbidden.push_back(gx+gy*W);
  bfs(sp,forbidden,0);

  sp = star;
  forbidden.push_back(gx+gy*W);
  //forbidden.clear();
  bfs(sp,forbidden,1);

  ld L = 0, R = 1e10, M = 0;
  rep(i,70){
    M = ( L + R ) * (ld)0.5;
    if( check(M) ) R = M;
    else           L = M;
  }

  cout << setiosflags(ios::fixed) << setprecision(20) << min((ld)mincost[sy][sx][0],(ld)mincost[sy][sx][1]+L) << endl;

  return 0;
}

Measured memory_bytes: 10456
import java.util.Map;
import java.util.Scanner;

public class Main {

    /**
     * 本処理を実行します。
     */
    public static void execute() {
        Scanner sc = new Scanner(System.in);

        String s = nextString(sc);
        char[] ca = s.toCharArray();

        for (int i = 0; i < ca.length - 1; i++) {
            if (ca[i] == 'A' && ca[i + 1] == 'C') {
                out("Yes");
                return;
            }
        }

        out("No");

    }

    /**
     * 次の標準入力をintで受け取ります。
     * @return 標準入力値(int)
     */
    public static int nextInt(Scanner sc) {
        return sc.nextInt();
    }

    /**
     * 次の標準入力をStringで受け取ります。
     * @return 標準入力値(String)
     */
    public static String nextString(Scanner sc) {
        return sc.next();
    }

    /**
     * 次の標準入力を指定回数分intで受け取ります。
     * @param n 取得回数
     * @return 取得した標準入力値の配列(int)
     */
    public static int[] nextInts(Scanner sc, int n) {
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = nextInt(sc);
        }

        return arr;
    }

    /**
     * 標準出力にオブジェクトを出力します。
     * @param o 出力対象
     */
    public static void out(Object o) {
        System.out.println(o);
    }

    public static void main(String[] args) {
        execute();
    }

    public static void putCountMap(Map<Integer, Integer> map, int value) {
        if (map.containsKey(value)) {
            map.put(value, map.get(value) + 1);
        } else {
            map.put(value, 1);
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int a=0,b=0,c=0; 
char anko;

int main() {
 while(1){
   cin >> a >> anko >> b;
   if(anko=='?'){
     break;
   }
   if(anko=='+'){
     c=a+b;
   }
   if(anko=='-'){
     c=a-b;
   }
   if(anko=='*'){
     c=a*b;
   }
   if(anko=='/'){
     c=a/b;
   }
   cout << c << endl;
 }
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define sync                    \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0)
#define ss second
#define ff first
#define ll long long
#define mp make_pair
#define endl "\n"
#define pb push_back
#define ld long double
#define M_PI 3.14159265358979323846
#define puss vector
#define ull unsigned long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i >= (a); --i)

double EPS = 0.0000001;
const ll INF = 1000000007;

using namespace std;

int main(){
    vector<bool> pr(100001, true);
    for (ll i=2; i<=100000; i++){
        if (pr[i]){
            for (ll j=i*i;j<=100000;j+=i)
                pr[j]=false;
        }
    }
    vector<int> ans(100001, 0);
    FOR(i, 2, 100001){
        if (i%2==1&&pr[i]&&pr[(i+1)/2]) ans[i]=ans[i-1]+1;
        else ans[i]=ans[i-1];
    }
    int q;
    cin>>q;
    FOR(h, 0, q){
        int l, r;
        cin>>l>>r;
        cout<<ans[r]-ans[l-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
M, D = map(int,input().split())

Futaketa_max = D//10
Hitoketa_max_max = D % 10

counter = 0
for t in range(M):
  m = t+1
  for i in range(Futaketa_max):
    if m % (i+1) ==0 and m / (i+1) >=2:
      d2 = m / (i+1)
      if d2 < 10:
        if m/d2 >=2:
          if i+1 == Futaketa_max:
            if d2 <= Hitoketa_max_max:
              #print(m, i+1,d2,'1')
              counter += 1
          else:
            #print(m, i+1,d2,'2')
            counter += 1
print(counter)

Measured memory_bytes: 3064
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());
#define usort(a) sort(a.rbegin(),a.rend());

using namespace::std;

ll int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

ll int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  ll int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
ll  int lcm(ll int c,ll int d){//最小公倍数
  ll int p=(c*d)/(gcd(c,d));
  return p;
}


int main(){
  int N;cin>>N;
  vector<int> a(N);
  rep(i,0,N) cin>>a[i];
  
  int count=0;
  rep(i,0,N){
    if(a[i]==count+1) count++;
  }
  cout<<(!count?-1:N-count);
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート
//  sort(変数名.rbegin(),変数名.rend());//降順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順

Measured memory_bytes: 1024
import java.util.Scanner;

class Problem
{
    public void copy(String arr[], int n)
    {
        for(int i = 0; i<n;i++)
        {
            if(i == n-1)
            {
                System.out.println(arr[i]);
                break;
            }
            System.out.print(arr[i]+" ");
        }
    }
    public void check(String arr[],int n, String o[])
    {
        Boolean isStable = true;
        for(int i = 0; i<n-1; i++)
        {
            if(Integer.parseInt(arr[i].substring(1))==Integer.parseInt(arr[i+1].substring(1)))
            {
                String a = arr[i];
                String b = arr[i+1];
                for(int j =0; j<n;j++)
                {
                    if(o[j].compareTo(a)==0) break;
                    else if ((o[j].compareTo(b)==0))
                    {
                        isStable = false;
                        break;
                    }
                }   
            }
        }
        if(isStable ==true)System.out.println("Stable");
        else System.out.println("Not stable");
    }
}
class Main
{
    public static void main(String[] args)throws Exception
    {
       Scanner sc = new Scanner(System.in); 
       int n = sc.nextInt(); 
       String [] s = new String[n];
       String [] bs = new String[n];
       String [] ss = new String[n];
       for(int i = 0; i<n; i++)  //Input
       {
           s[i] = sc.next();
           bs[i] = s[i];
           ss[i] = s[i];
       }
     
       for(int i = n; i>0; i--) //Bubble Sort
       {
           for(int j = 0; j<n-1; j++)
           {
               if(Integer.parseInt(bs[j].substring(1))>Integer.parseInt(bs[j+1].substring(1))) 
               {
                   String temp = bs[j+1];
                   bs[j+1] = bs[j];
                   bs[j] =temp; 
               }
           }
       }
       int min;
       for(int i = 0; i<n; i++) //Selection sort
       {
           int indx = i;
           min = Integer.parseInt(ss[i].substring(1));
           for(int j = i+1; j<n; j++)
           {
               if(min>Integer.parseInt(ss[j].substring(1))) 
               {
                   min = Integer.parseInt(ss[j].substring(1));
                   indx = j;
               }
           }
           String temp = ss[i];
           ss[i] = ss[indx];
           ss[indx] = temp;
       }
       Problem p = new Problem();
       p.copy(bs,n);
       p.check(bs, n, s);
       p.copy(ss, n);
       p.check(ss, n, s);
    }
}
       





Measured memory_bytes: 26752
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
const ll MOD=998244353;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};

int main()
{
  int n;
  cin >> n;
  vector<ll> d(n);
  rep(i,n) cin >> d[i];

  if(d[0]!=0){
    cout << 0 << "\n";
    return 0;
  }
  sort(d.begin(), d.end());
  if(d[1]==0){
    cout << 0 << "\n";
    return 0;    
  }
  mint res(1);
  ll cnt1 = 1,cnt2 = 1;
  rep(i,n-1){
    if(d[i]!=d[i+1]){
      if(d[i]+1!=d[i+1]){
	cout << 0 << "\n";
	return 0;
      }
      mint kk(cnt1);
      res *= kk.pow(cnt2);
      
      cnt1 = cnt2;
      cnt2 = 1;
    }
    else{
      cnt2++;
    }
  }

  mint kk(cnt1);

  res *= kk.pow(cnt2);
  cout << res.x << "\n";

  return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, m;
    cin >> n >> m;
    vi h(n);
    rep(i, n) cin >> h[i];
    vector<vi> to(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        to[a].pb(b);
        to[b].pb(a);
    }
    int ans = 0;
    rep(i, n) {
        int hi = h[i];
        bool ok = true;
        for (int t : to[i]) {
            if (h[t] >= hi) ok = false;
        }
        if (ok) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8804
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define ll long long
#define pp pair<int,int> 
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
 
int main(){
  int a,b;
  cin >> a >> b;
  if(b%a==0) cout << a+b << endl;
  else cout << b-a << endl;
}    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
	scanf("%d", &n);
	int mn = n + 1, ans = 0;
	for(int i = 1; i <= n; ++i) {
		int x; 
		scanf("%d", &x);
		mn = min(mn, x);
		ans += (mn >= x);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string.h>

using namespace std;

using ll = long long;

int N, A[200005];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
  }
  if (A[1] != 0) {
    printf("%d\n", -1);
    return 0;
  }
  for (int i = 2; i <= N; i++) {
    if (A[i] - A[i - 1] > 1) {
      printf("%d\n", -1);
      return 0;
    }
  }

  ll res = 0;
  for (int i = 2; i <= N; i++) {
    if (A[i] == A[i - 1] + 1) {
      res++;
    } else {
      res += A[i];
    }
  }
  printf("%lld\n", res);
  return 0;
}


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


int main(){
  vector<int>di;
  int N, K, A, d, ans = 0;
  
  cin >> N >> K;
 
  vector<bool>Nb(N, false);
  
  rep(i, K){ 
    cin >> d;

    rep(j, d){
      cin >> A; Nb[A-1] = true;
    }
  }

  rep(i, N){
    //cout << "Nb[i]" << " = " << Nb[i] << endl;
	if(Nb[i] == false){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
/* 
  ╔╗         ╔╗              ╔═══╗                                  
  ║║        ╔╝╚╗             ║╔═╗║                                  
  ║║╔╗╔╗╔══╗╚╗╔╝    ╔══╗     ║╚═╝║╔═╗╔══╗╔══╗╔═╗╔══╗ ╔╗╔╗╔╗╔╗╔══╗╔═╗
╔╗║║║║║║║══╣ ║║     ╚ ╗║     ║╔══╝║╔╝║╔╗║║╔╗║║╔╝╚ ╗║ ║╚╝║║╚╝║║╔╗║║╔╝
║╚╝║║╚╝║╠══║ ║╚╗    ║╚╝╚╗    ║║   ║║ ║╚╝║║╚╝║║║ ║╚╝╚╗║║║║║║║║║║═╣║║ 
╚══╝╚══╝╚══╝ ╚═╝    ╚═══╝    ╚╝   ╚╝ ╚══╝╚═╗║╚╝ ╚═══╝╚╩╩╝╚╩╩╝╚══╝╚╝ 
                                         ╔═╝║                       
                                         ╚══╝                       */


//Header files
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#ifndef ONLINE_JUDGE
#include<Personal/debug.h>
#else
#define debug(x...)
#endif

//Short data-types declaration
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<vector<int> > vii;  
typedef vector<vector<long long> >vll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vbb;

//Macros
#define MK make_pair
#define EB emplace_back
#define PB push_back
#define F first
#define S second
#define rep(i,start,end) for(int i=(int)start;i<(int)end;i++)
#define repr(i,start,end) for(int i=(int)start;i>(int)end;i--)
#define all(x) (x).begin(), (x).end()

//Constants
const int mod = 1e9+7;

//Some useful functions
ll binpow(ll num,ll pow);
inline int mul(int a,int b) {return (a*1ll*b)%mod;}
inline int add(int a,int b) {return (a+0ll+b)%mod;}
inline int sub(int a,int b) {return ((a+0ll-b)%mod+mod)%mod; }
/*------------------------------------------------------Code Starts------------------------------------------------------*/
inline void solve()
{
	ll n,d;
	cin>>n>>d;
	d*=d;
	int ans=0;
	rep(i,0,n)
	{
		ll x,y;
		cin>>x>>y;
		ll cd=x*x + y*y;
		if(cd<=d) ans++;
	}
	cout<<ans<<'\n';

}

int main()
{
	auto start = high_resolution_clock::now();
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start); 
	cerr<<duration.count()<<" microseconds\n";
	return 0;
}
/*------------------------------------------------------Code ends------------------------------------------------------*/
ll binpow(ll num,ll pow)
{
	if(pow==0)
		return 1;
	ll val=binpow(num,pow/2);
	val*=val;
	if(pow&1) val*=num;
	return val;
}



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

using namespace std;
using ll = long long;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount

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

int H, W;
vector<string> a;
int dp[1010][1010];

void add(int &a, int b) {
    a += b;
    if (a >= MOD)a -= MOD;
}

int main() {
    cin >> H >> W;
    a.resize(H);
    for (int i = 0; i < H; ++i) {
        cin>>a[i];
    }
    dp[0][0] = 1;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i + 1 < H && a[i + 1][j] == '.')add(dp[i + 1][j], dp[i][j]);
            if (j + 1 < W && a[i][j + 1] == '.')add(dp[i][j + 1], dp[i][j]);
        }
    }
    cout << dp[H - 1][W - 1] << endl;

    return 0;
}

Measured memory_bytes: 5248
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int res = 700;
    for(int i = 0; i < 3; i++){
        char a;
        cin >> a;
        if(a == 'o') res += 100;
    }    
    cout << res << endl;
}

Measured memory_bytes: 256
#3200超えが普通のレートに無い色を使えることが頭に無かった
n = int(input())
rt = list(map(int,input().split()))
clr = [0 for _ in range(9)]
for i in range(n):
  now = rt[i] // 400
  try:
    clr[now] += 1
  except:
    clr[8] += 1
ans = 0
top = clr[8]
for j in range(8):
  if clr[j] != 0:
    ans += 1
if top == 0:
  print(ans,ans)
else:
  print(max(ans,1),ans+top)
#print(clr)

Measured memory_bytes: 3064
import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val n = scn.next()
	val k = scn.nextInt()
	val dpc = Array(n.length){LongArray(k+1)}
	val dpuc = Array(n.length){IntArray(k+1)}
	dpc[0][0] = 1
	dpc[0][1] = Integer.parseInt(n.substring(0,1))-1L
	dpuc[0][1] = 1
	for (i in 1 until n.length){
		dpc[i][0] = 1
		for (j in 1..Math.min(i+1, k)){
			dpc[i][j] = dpc[i-1][j] + 9*dpc[i-1][j-1]
			if (Integer.parseInt(n.substring(i, i+1))>0){
				dpc[i][j] += (Integer.parseInt(n.substring(i, i+1))-1)*dpuc[i-1][j-1] + dpuc[i-1][j].toLong()
				dpuc[i][j] = dpuc[i-1][j-1]
			}else {
				dpuc[i][j] = dpuc[i-1][j]
			}
		}
	}
	println(dpc[n.length-1][k]+dpuc[n.length-1][k])
}

Measured memory_bytes: 29604
def dot(matrix1:[],matrix2:[])
    answer = Array.new(matrix1.size).map{Array.new(matrix2[0].size,0)}
    matrix1.size.times do |i|
        matrix2[0].size.times do |j|
            matrix2.size.times do |k|
                answer[i][j] += matrix1[i][k]*matrix2[k][j]
            end
        end
    end
    return answer
end

n,m,l = *gets.split.map(&:to_i)
matrix1 = []
matrix2 = []
n.times do
    matrix1.push(gets.split.map(&:to_i))
end
m.times do
    matrix2.push(gets.split.map(&:to_i))
end
answer = dot(matrix1:matrix1,matrix2:matrix2)
answer.each do |array|
    puts array.join(" ")
end


Measured memory_bytes: 8904
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define EPS (1e-7)
#define INF 1000000009
#define PI (acos(-1))

int a,b;

int main(){
    cin >> a >> b;
    rep(i,11000){
        if (i*0.08 >= a && i*0.1 >= b && i*0.08 < (a+1) && i*0.1 < (b+1)){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
using namespace std;

int main(){
int n,sum,buf;
std::vector<int> v;
cin>>n;
for(int i=0;i<n;i++){
  cin>>buf;
  v.push_back(buf);
}

sort(v.begin(),v.end());
v[v.size()-1]=v[v.size()-1]/2;
sum = accumulate(v.begin(),v.end(),0);

printf("%d",sum);


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
const int RLEN=1<<18|1;
inline char nc() {
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
	char ch=nc(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
	return i*f;
}
inline void W(int x) {
	static int buf[50];
	if(!x) {putchar('0'); return;}
	if(x<0) {putchar('-'); x=-x;}
	while(x) {buf[++buf[0]]=x%10; x/=10;}
	while(buf[0]) {putchar(buf[buf[0]--]+'0');}
}

const int N=1e5+50;
int n,a[N];
inline int gs(int x,int y) {
	if(y>=a[x+1]) return 0;
	return gs(x+1,y)+1;
} 
inline bool mustwin(int x,int y) {
	if(y>=a[x+1]) return true;
	if((a[x+1]-y+gs(x,y)-2)&1) return true;
	return false;
}
int main() {
	n=rd();
	for(int i=1;i<=n;i++) a[i]=rd();
	sort(a+1,a+n+1); reverse(a+1,a+n+1);
	int l=1, r=n-1, ans=0;
	while(l<=r) {
		int mid=(l+r)>>1;
		if(a[mid+1]>mid) ans=mid, l=mid+1;
		else r=mid-1;
	}
	if(mustwin(ans,ans+1) && mustwin(ans+1,ans)) puts("Second");
	else puts("First");
}

Measured memory_bytes: 896
from functools import lru_cache
import sys

mod=1000000007

n,k=[int(i) for i in input().split(" ")]



facts=[1 for i in range(n+k+1)]

for i in range(1,n+k+1):
    facts[i]=i*facts[i-1]

if n<k:
    print(0)
    sys.exit()

tables=[[-1 for i in range(k+1)] for j in range(n+1)]

def f(n,k):
    if k==1:
        return 1

    elif n==k:
        return facts[n]%mod

    elif tables[n][k]!=-1:
            return tables[n][k]

    else:
        retval=(k*f(n-1,k)+k*f(n-1,k-1))%mod
        tables[n][k]=retval
        return retval

print(f(n,k)%mod)



Measured memory_bytes: 20596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=105;
int a[maxn];
int main(){
	ll a,b,n;
	cin>>a>>b>>n;
	ll ans=a*n/b-a*(n/b);
	if(b<=n){
		ll x=a*(b-1)/b;	
		if(x>ans) ans=x;
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int H, W, N;
  while(cin >> H >> W >> N && (H|W|N)) {
    vector<vector<int>> G(H, vector<int>(W));
    rep(i, H) rep(j, W) {
      cin >> G[i][j];
    }

    vector<vector<int>> dp(H+10, vector<int>(W+10));
    dp[0][0] = N - 1;
    rep(i, H) rep(j, W) {
      if(G[i][j]) {
        dp[i][j+1] += (dp[i][j] + 1) / 2;
        dp[i+1][j] += (dp[i][j]) / 2;
      } else {
        dp[i+1][j] += (dp[i][j] + 1) / 2;
        dp[i][j+1] += (dp[i][j]) / 2;
      }
    }

    std::function<pair<int,int>(int, int)> dfs = [&](int y, int x) {
      if(y>=H || x>=W){
        return make_pair(y+1, x+1);
      }
      if(G[y][x]) {
        return dfs(y + dp[y][x] % 2, x + (dp[y][x] + 1) % 2);
      } else {
        return dfs(y + (dp[y][x] + 1) % 2, x + dp[y][x] % 2);
      }
    };

    auto k = dfs(0, 0);
    cout << k.first << " " << k.second << endl;

  }

  return 0;
}

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

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


Measured memory_bytes: 1024