akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}

        
//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int N,M,Q;
vi a,b,c,d;
int ans=0;
void dfs(vi A){
  if(A.size()==N){
    int now=0;
    rep(i,Q){
      if(A[b[i]]-A[a[i]] ==c[i]){
        now +=d[i];
      }
    }
    ans = max(ans,now);
    return;
  }
  int prev=(A.empty() ?  1:A.back());
  for(int i=prev; i<=M; i++ ){
    A.pb(i);
    dfs(A);
    A.pop_back(); 
  }
    
}
int main(){
  cin>>N>>M>>Q;
  vi w(Q),x(Q),y(Q),z(Q);
  rep(i,Q){
    cin>>w[i]>>x[i]>>y[i]>>z[i];
    w[i]--;x[i]--;
  }
  a=w;b=x;c=y;d=z;
  vi B={};
  dfs(B);
  cout<<ans<<endl;
  
}






Measured memory_bytes: 3720
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif

static void C_task();

int main()
{
	C_task();
	
	fflush(stdout);
	return 0;
}

static void C_task()
{
	int N, K;

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

	double prob = 0.0;
	double tmpP = 0.0;
	for (int i = 1; i <= N; i++) {
		tmpP = 1.0 / (double)N;
		
		if(i >= K) {
			prob += tmpP;
			continue;
		}

		int score = i;
		while (score < K) {
			tmpP *= 0.50;
			score *= 2;
		}
		prob += tmpP;
	}

	printf("%.12lf\n", prob);
}


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

#define MAX_N (100)

int main(int argc, char *argv[]) {
  // read inputs
  char S[MAX_N + 1];
  scanf("%s", S);
  const int N = strlen(S);

  const char str[] = "keyence";
  if (N < 7) {
    printf("NO\n");
    return 0;
  }
  // first few and last few match
  int match = 1;
  for (int i = 0; i < 7; i++) {
    // printf("i = %d, S = %c, str = %c\n", i, S[i], str[i]);
    if (S[i] != str[i]) {
      // S[N - 7 + i:N] must match str[i:7]
      for (int j = i; j < 7; j++) {
        // printf("j = %d, S = %c, str = %c\n", j, S[j], str[j]);
        if (S[N - 7 + j] != str[j]) {
          match = 0;
        }
      }
      break;
    }
  }
  if (match) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
  ll N, A, B; cin >> N >> A >> B;
  cout << A*(N/(A+B)) + min((N%(A+B)), A) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int t=0,tmp,i,min = 10;
    for(i = 0;i<5;i++){
        scanf("%d",&tmp);
        if(tmp % 10 == 0){
            t+= tmp;
        }else
        {   
            if(tmp%10<min) min = tmp%10;
            tmp += 10-tmp%10;
            t += tmp;
        }
        
    }
    t -= (10-min);
    //printf("%d\n",min);
    printf("%d",t);
    return 0;
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;
  cin>>s;
  ll res=(1<<30);
  for(int i=0;i<s.size()-1;i++){
    if(s[i] != s[i+1]) {
      ll t1 = i + 1;
      ll t2 = s.size()-i-1;
      res = min( res, max(t1, t2) );
    }
  }
  if(res==(1<<30))res=s.size();
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;

	vector<int> xx(n), yy(m);
	for(int i=0;i<n;i++) cin >> xx.at(i);
	for(int i=0;i<m;i++) cin >> yy.at(i);
	sort(xx.begin(), xx.end());
	sort(yy.begin(), yy.end());

	if(xx.at(n-1)<yy.at(0) && x<yy.at(0) && yy.at(0)<=y)
		cout << "No War" << endl;
	else
		cout << "War" << endl;
}

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

void solveA(){
  int a,b;
  cin >> a >> b;

  if (b%a==0){
    cout << a+b << endl;
  }
  else {
    cout <<b-a << endl;
  }
}
void solveB(){
  int n,m,k,a;
  cin >> n >> m;
  int cnt[m+1]={0};
  int ans = 0;

  for(int i=0; i<n; i++){
    cin >> k;
    for(int j=0;j<k;j++){
      cin >>a;
      cnt[a]++;
    }
  }

  for(int i=0;i<m+1;i++){
    //    cout << cnt[i] << endl;
    if (cnt[i]==n) ans++;
  }
  cout << ans << endl;
}
void solveC(){
}
void solveD(){
}

int main(){
  solveB();
}


Measured memory_bytes: 256
import sys
from collections import deque

input = sys.stdin.readline
 
N,M=map(int,input().split())
E=[[] for i in range(N+1)]
 
for i in range(M):
    x,y=map(int,input().split())
    E[x].append(y)
    E[y].append(x)

USE=[-1]*(N+1)
USE[0]=0
USE[1]=0
 

Q=deque()
Q.append(1)

while Q:
    x=Q.pop()
    for to in E[x]:
        if USE[to]==-1:
            USE[to]=x
            Q.appendleft(to)
 
if -1 in USE:
    print("No")
else:
    print("Yes")
    for i in USE[2:]: print(i)

Measured memory_bytes: 34812
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,a[100005],ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		if(i==n-1){
			ans+=a[i]/2;
		}
		else
		ans+=a[i];
	}
	cout<<ans<<endl;
  return(0);
}

Measured memory_bytes: 256
#include <cstdio>
#include <math.h>

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

  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);

  if (a < b && b < c) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 2624
import java.util.*;

public class Main{
    int N,M,L,K,A,H;
    long[][] d;
    boolean[] cancold;
    int INF = 1000000000;

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

    void solve(){
	Scanner sc = new Scanner(System.in);
	N = sc.nextInt();
	while(N!=0){
	    M = sc.nextInt();
	    L = sc.nextInt();
	    K = sc.nextInt();
	    A = sc.nextInt();
	    H = sc.nextInt();
	    cancold = new boolean[N];
	    for(int i=0; i<L; i++){
		cancold[sc.nextInt()] = true;
	    }
	    cancold[A] = true; cancold[H] = true;
	    
	    d = new long[N][N];
	    for(int i=0; i<N; i++){Arrays.fill(d[i],INF);}
	    for(int i=0; i<K; i++){
		int x = sc.nextInt();
		int y = sc.nextInt();
		int t = sc.nextInt();
		d[y][x] = t;
		d[x][y] = t;
	    }

	    for(int i=0; i<N; i++)d[i][i] = 0;

	    warshall_floyd();

	    for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
		    if(d[i][j]>M || !(cancold[i] && cancold[j])){
			d[i][j] = INF;
		    }
		}
	    }

	    warshall_floyd();

	    if(d[A][H]==INF){
		System.out.println("Help!");
	    }else{
		System.out.println(d[A][H]+Math.max(0,d[A][H]-M));
	    }

	    N = sc.nextInt();
	}
    }

    void warshall_floyd(){
	for(int k=0; k<N; k++)
	    for(int i=0; i<N; i++)
		for(int j=0; j<N; j++)d[i][j] = Math.min(d[i][j],d[i][k]+d[k][j]);
    }
}

Measured memory_bytes: 16000
n,m,x = map(int,input().split())
c = []
A = []
Min = 9999999999
for i in range(n):
    a = list(map(int,input().split()))
    c.append(a[0])
    A.append(a[1:])
for i in range(2**n):
    lists = []
    m_list = [0]*m
    cost = 0
    for j in range(n):
        if ((i >> j) & 1):
            lists.append(1)
        else:
            lists.append(0)
    for k in range(len(lists)):
        if lists[k] == 1:
            cost += c[k]
            for s in range(m):
                m_list[s] += A[k][s]
        else:
            pass
    cnt = 0
    for h in range(m):
        if m_list[h] >= x:
            cnt += 1
    if cnt >= m:
        Min = min(Min,cost)
if Min == 9999999999:
    print(-1)
else:
    print(Min)

            


Measured memory_bytes: 68948
/* while(!cin.eof()) */

#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod (int)(1e9+7)
#define MAXI (int)(1e18+100)
#define N 1000200 

int fre[N];

// Driver code to test above functions
int32_t main()
{
    
 
     
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i=0;i<3;i++)
        if(s[i]==t[i])
            ans++;

    cout << ans;


    return 0;  
} 

Measured memory_bytes: 256
from math import gcd
n = int(input())
P = [tuple(map(int, input().split())) for i in range(n)]
C = {}
for x, y in P:
    if x == 0 and y == 0:
        x0, y0 = 0, 0
    elif x != 0 and y == 0:
        x0, y0 = 1, 0
    elif x == 0 and y != 0:
        x0, y0 = 0, 1
    else:
        g = gcd(x, y)
        x0, y0 = x // g, y // g
    if y0 < 0:
        x0, y0 = -x0, -y0
    try:
        C[(x0, y0)] += 1
    except KeyError:
        C[(x0, y0)] = 1
D = []
for x, y in C.keys():
    if x <= 0:
        try:
            C[(y, -x)]
        except KeyError:
            D.append((y, -x))
for x, y in D:
    C[(x, y)] = 0
ans = 1
p = 10**9 + 7
for x, y in C.keys():
    if x > 0:
        a = C[(x, y)]
        try:
            b = C[(-y, x)]
        except KeyError:
            b = 0
        ans *= pow(2, a, p) + pow(2, b, p) - 1
        ans %= p
try:
    ans += C[(0, 0)] - 1
except KeyError:
    ans -= 1
print(ans % p)


Measured memory_bytes: 87904
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;

int main(){
	float big = 0, small = 100000;
	float input[1000];
	int i=0;

	while(scanf("%f", &input[i]) != EOF){
		big = max(big, input[i]);
		small = min(small, input[i]);
		i++;
	}
	cout << big - small << endl;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << - 1 << endl;}
void unhap() {cout << ":(" << endl;}

//素数判定．0:素数ではない
long long checkp(long long n) {
  if (n == 1) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (long long i = 3; i <= sqrt(n); i += 2)
    if (n % i == 0) return 0;
  return 1;
}

int main() {
  ll x;
  cin >> x;
  while (1) {
    if (checkp(x) == 1) {
      cout << x << endl;
      return 0;
    }
    else x++;
  }
}

Measured memory_bytes: 256
require 'pp'
n = gets.to_i
x = gets.split.map(&:to_i)

min = 10**10

sum = 0
(x.min).upto(x.max) do |a|
  sum = x.map{|b| (b-a)**2 }.inject(:+)
  min = sum if sum <= min
  sum = 0
end

p min


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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n-1; i >= 0LL; i--)
#define FOR(i, n, m) for(ll i = n; i < (ll)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18
#define INFD 1e18
#define PI 3.14159265358979
#define MOD 1000000007
#define vl vector<ll>

vector<ll> dx = {-1, 1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

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


int main()
{
	ll N, K;
	cin >> N >> K;
	set<ll> s;
	REP(i, K) {
		ll d;
		cin >> d;
		REP(j, d) {
			ll A;
			cin >> A;
			s.insert(A);
		}
	}
	PRINT(N-s.size());
	return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
int main()
{
	int n,i,x=0,y=0;
	scanf("%d",&n);
	int v[n],c[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&v[i]);
	}
	for(i=0;i<n;i++)
	{
		scanf("%d",&c[i]);
	}
	for(i=0;i<n;i++)
	{
		if(v[i]>c[i])
		{
			x+=v[i];
			y+=c[i];
		}
	}
	printf("%d\n",(x-y));
	
}

Measured memory_bytes: 1724
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
#pragma endregion

void solve() {
  int n;
  cin >> n;
  cout << exp(n, 3) << endl;
}


Measured memory_bytes: 256
a = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
k = list(a.split(", "))
n = int(input())-1
print(k[n])

Measured memory_bytes: 2940
n=gets.to_i
a=gets.split.map(&:to_i)
t=0
s=0
c=0
n.times{|i|
  if t==a[i] then c+=1 
  else s+=((c-1)/2.0).ceil
    c=1 end
  t=a[i]
}
s+=((c-1)/2.0).ceil
p s

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

void input()
{ 
    #ifndef ONLINE_JUDGE 
    freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
    #endif
}
#define endl "\n"
#define ll long long int
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define tll tuple<ll,ll,ll>
#define mt make_tuple
#define INF LONG_LONG_MAX
#define mod 1000000007
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define cases ll t; cin>>t; while(t--)
#define array(a,n) ll a[n]; rep(i,0,n) cin>>a[i];
#define vector(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define sortall(a) sort(a.begin(),a.end())
#define printall(a,n) rep(i,0,n) cout<<a[i]<<" "; cout<<endl;

// --------------- My Template End --------------- //


int main()
{
    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    //input();
    ll n,sum=0,diff=0;
    cin>>n;
    vector(a,n);
    vector <vector<ll>>dp(n,vector<ll>(n,0));
    rep(i,0,n){sum+=a[i];dp[i][i]=a[i];}
    
   rep(gap,2,n+1)
   {
    rep(i,0,n-gap+1)
    {
        int j=i+gap-1;
        if(j==i+1)dp[i][j]=max(a[i],a[j]);
        else{
                dp[i][j]=max(a[i]+min(dp[i+1][j-1],dp[i+2][j]),a[j]+min(dp[i][j-2],dp[i+1][j-1]));
            }
       
        }      
    }
    
    
    cout<<2*dp[0][n-1]-sum;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll H,W;
map<P,int> mp;
set<P> used;
int N;
vector<ll> res;

bool ischeck( int a, int b ){
  if( a < 1 || a > H || b < 1 || b > W ) return false;
  return true;
}

int count( int a, int b ){
  int cnt = 0;
  for(int y=a;y<a+3;y++){
    for(int x=b;x<b+3;x++){
      if( mp.count( P(y,x) ) ) cnt++;
    }
  }
  return cnt;
}



void solve( P p ){
  for(int a=p.first-2;a<=p.first;a++){
    for(int b=p.second-2;b<=p.second;b++){
      if( used.count( P(a,b) ) ) continue;
      if( ischeck( a, b ) && ischeck( a+2, b+2 ) ){
        res[ count( a, b ) ]++;
        used.insert( P(a,b) );
      }
    }
  }
}

int main(){
  cin >> H >> W;
  cin >> N;
  vector<P> p;
  for(int i=0;i<N;i++){
    int a,b; cin >> a >> b;
    p.push_back( P(a,b) );
    mp[p[i]] = 1;
  }

  res.resize(10,0);
  for(int i=0;i<N;i++){
    solve( p[i] );
  }

  ll sum = (H-2LL)*(W-2LL);
  for(int i=1;i<10;i++) sum -= res[i];
  cout << sum << endl;
  for(int i=1;i<10;i++){
    cout << res[i] << endl;
  }
  
}


Measured memory_bytes: 49524
#include <iostream>
#include <cmath>

bool is_prime(int n){
  bool flag = true;
  if(n % 2 == 0) flag = false;
  for(int i=3; i <= sqrt(n); i+=2){
    if(n % i == 0){
      flag = false;
      break;
    }
  }
  if(n == 2) flag = true;
  return flag;
}

int main(void){
  int n;
  while(1){
    int cnt = 0;
    std::cin >> n;
    if(n == 0)  return 0;
    for(int i = n+1; i <= 2*n; i++){
      if(is_prime(i)){
      cnt++;
      }
    }
    std::cout << cnt << std::endl;
  }
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(a - c) <= d) {
    cout <<  "Yes" << endl;
  } else if (abs(a-b) <= d && abs(b-c) <= d) {
    cout <<  "Yes" << endl;
  } else {
    cout <<  "No" << endl;
    
  }
  return 0;
}

Measured memory_bytes: 256
n=gets.to_i
c=0
n.times{
  s=gets.to_i
  f=true
  x=1
  while 2*x*x+x+x<=s
    if (s-x)%(2*x+1)==0
      f=false
      break
    end
    x+=1
  end
  c+=1 if f
}
puts c


Measured memory_bytes: 6876
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

int n;
vector<int> x,v;

void input(){
    cin >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        x.push_back(a);
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    v = x;
    sort(v.begin(), v.end());
    int med1 = v[n/2-1];
    int med2 = v[n/2];
    for(int i=0;i<n;i++){
        if(x[i] < med2) cout << med2 << endl;
        else cout << med1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,c,k,a[N],ans,sum,ji;
int main()
{
	cin>>n>>c>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	ji=a[0];
	sum=1;
	for(int i=1;i<n;i++)
	{
		if(k<a[i]-ji||sum==c)
			ans++,sum=1,ji=a[i];
		else
			sum++;
	}
	if(sum)ans++;
	cout<<ans<<endl;
}

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

int main()
{
  char a;
  cin >> a;
  if (isupper(a))
    cout << "A" << endl;
  else
    cout << "a" << endl;
}


Measured memory_bytes: 3636
A = sorted(sorted(map(int, input().split())) for i in range(6))
if all(a==b for a, b in zip(A[::2], A[1::2])):
    p, q, r = A[::2]
    if (p[0] in q and p[1] in r and q[q.index(p[0])^1] == r[r.index(p[1])^1]) or (p[0] in r and p[1] in q and r[r.index(p[0])^1] == q[q.index(p[1])^1]):
        print("yes")
    else:
        print("no")
else:
    print("no")

Measured memory_bytes: 7752
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  ll ans=0;
  vector<ll> A(N);
  for(ll i=0;i<N;i++) {
cin>>A[i];
  }
  vector<ll> note(N,0);
  
  for(ll i=N;i>0;i--) {
    ll count=N/i;
    if(count==1) {
note[i-1]=A[i-1];
      if(A[i-1]==1) {
ans++;
      }
    continue;
    }
    ll sum=0;
    
    for(ll j=2;j<=count;j++) {
      sum+=note[i*j-1];
    }
    if(sum%2==A[i-1]) {
note[i-1]=0;
    }
    else {
note[i-1]=1;
      ans++;
    }
  }
  cout<<ans<<endl;
  for(ll i=0;i<N;i++) {
if(note[i]==1) {
cout<<i+1<<" ";
}
  }
  
  cout<<endl;
}

    


  
  
  

Measured memory_bytes: 6328
#include <bits/stdc++.h>
#define enter putchar('\n')
#define space putchar(' ')
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define MAXN 1000005
#define mo 999999137
#define pb push_back
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) out(x / 10);
    putchar('0' + x % 10);
}
int N;
int64 M;
int a[100005],num[100005],cnt;
int sum[100005][2],c[200005];
int tr[200005];
int lowbit(int x) {return x & -x;}
void Insert(int x,int v) {
    while(x <= 2 * N + 1) {
        tr[x] += v;
        x += lowbit(x);
    }
}
int Query(int x) {
    int res = 0;
    while(x > 0) {
        res += tr[x];
        x -= lowbit(x);
    }
    return res;
}
bool check(int x) {
    for(int i = 1 ; i <= N ; ++i) {
        sum[i][0] = sum[i - 1][0] + (a[i] <= x);
        sum[i][1] = sum[i - 1][1] + (a[i] > x);
    }
    memset(tr,0,sizeof(tr));
    for(int i = 1 ; i <= N ; ++i) Insert(sum[i][1] - sum[i][0] + N + 1,1);
    int64 res = 0;
    for(int i = 1 ; i <= N ; ++i) {
        int t = sum[i - 1][1] - sum[i - 1][0] + N + 1;
        res += Query(t - 1);
        Insert(sum[i][1] - sum[i][0] + N + 1,-1);
    }
    return res >= M;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    read(N);
    for(int i = 1 ; i <= N ; ++i) {read(a[i]);num[i] = a[i];}
    M = 1LL * N * (N + 1) / 2;
    M = M / 2 + 1;
    sort(num + 1,num + N + 1);
    cnt = unique(num + 1,num + N + 1) - num - 1;
    int L = 1,R = cnt;
    while(L < R) {
        int mid = (L + R) >> 1;
        if(check(num[mid])) R = mid;
        else L = mid + 1;
    }
    out(num[L]);enter;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
char s[maxn];
ll dp[maxn][2];
int main()
{
    //freopen("D:\\code\\text\\input.txt","r",stdin);
    //freopen("D:\\code\\text\\output.txt","w",stdout);
    s[0] = '0';
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    dp[n][0] = (s[n] - '0');
    dp[n][1] = 10 - (s[n] - '0');
    for (int i = n - 1; i >= 0; --i)
    {
        dp[i][0] = min(dp[i + 1][0] + (s[i] - '0'), dp[i + 1][1] + (s[i] - '0') + 1);
        dp[i][1] = min(dp[i + 1][0] + 10 - (s[i] - '0'), dp[i + 1][1] + 10 - (s[i] - '0' + 1));
    }
    printf("%lld\n", min(dp[0][0], dp[0][1]));
    return 0;
}




Measured memory_bytes: 16896
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll =long long;
using namespace std;
using graph=vector<vector<int>>;
using field=vector<string>;
using p =pair<int,int>;
const ll mod=1000000007;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

int main(){
    string s,t;
    cin>>s>>t;
    int len=s.size();
    vector<int> a(26,-1);
    vector<int> b(26,-1);
    rep(i,len){
        int p=s[i]-'a';
        int q=t[i]-'a';

        if(a[p]!=-1||b[q]!=-1){
            if(a[p]!=q||b[q]!=p){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            a[p]=q;
            b[q]=p;
        }
    }
    cout<<"Yes"<<endl;
}



Measured memory_bytes: 3932
#include<bits/stdc++.h>
//One implementation to rule them all?
#define db              double
#define ll              long long int
#define ld                long long double
//#define int           long long int
#define ull             unsigned long long
#define fi              first
#define se              second
#define rep(i,a,n)      for(int i=a;i<n;i++)
#define repr(i,n,b)     for(int i=n;i>=b;i--)
#define endl            '\n'
#define mem(a,b)        memset(a, b, sizeof a)
#define mkp             make_pair
#define pb              push_back
#define max3(a,b,c)     max(a,max(b,c))
#define min3(a,b,c)     min(a,min(b,c))
#define w(t)            int t; cin>>t; while(t--)
#define all(a)          a.begin(), a.end()
#define sz(a)           int((a).size())
//Bitwise 
#define isOn(S, j) (S & (1<<j))
#define setBit(S, j) (S |= (1<<j))
#define clearBit(S, j) (S &= ~(1<<j))
#define toggleBit(S, j) (S ^= (1<<j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1<<n)-1)
#define turnOffLastBit(S) ((S) & (S-1))
#define turnOnLastZero(S) ((S) | (S+1))
//Can use tuples in C++17
using namespace std;
typedef vector < int > vii;
typedef vector < ll > vll;
typedef vector < vii > vvi;
typedef pair < int,int > pii;
const db PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const ll LINF = (ll)2e18;
db eps       =          0.000001;
ll mod       =          (1e9+7);   //998244353
void print(vector <int> &arr){
    for(int i=0;i<arr.size();i++)
        cout<<arr[i]<<" ";
    
    cout<<endl;
}
void printll(vector <ll> &arr){
    for(int i=0;i<arr.size();i++)
        cout<<arr[i]<<" ";
    
    cout<<endl;
}

ll ncr(ll n, ll r)
{
    r=min(r,n-r);
    ll A[r],i,j,B[r];
    iota(A,A+r,n-r+1);  
    iota(B,B+r,1);     

    ll g;
    for(i=0;i<r;i++)
    for(j=0;j<r;j++)
    {
        if(B[i]==1)
            break;
        g=__gcd(B[i], A[j] );
        A[j]/=g;
        B[i]/=g;
    }
    ll ans=1;
    for(i=0;i<r;i++)
        ans=(ans*A[i]%mod);
    return ans;
}
const int SIZE=1e6+5;
bool judgePermutation(int a[], int n){
    static int used[SIZE+1];
    for(int i = 1; i <= n; i++) used[i] = 0;
    for(int i = 0; i < n; i++) used[a[i]] = 1;
    for(int i = 1; i <= n; i++) {
        if(!used[i]) return 0;
    }
    return 1;
}

int main(){ 
//CONDITION && cout << "YES" || cout << "NO"; cout << '\n';
//////////////////////////////////////////////////////////////////////
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr.tie(NULL);
//For fast IO
///////////////////////////////////////////////////////////////////// 
//  std::cout.unsetf ( std::ios::floatfield );  // floatfield not set
//  std::cout.precision(10);
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	vii arr(n);
	rep(i,0,n-1){
		int temp;
		cin>>temp;
		temp--;
		arr[temp]++;
	}
	rep(i,0,sz(arr)) cout<<arr[i]<<endl;
	return 0;
}

Measured memory_bytes: 3952
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=100010,logN=20;
lint f[N][logN];
int ldep[N];
lint cnt[N];
lint b[N];
inline int gpre(int x,lint val){
	for(int j=ldep[x];x&&j>=0;j--){
		if(f[x][j]>val){
			x-=1<<j;
		}
	}
	return x;
}
int main(){
	int n=ni,m=ni;
	ldep[0]=-1;
	for(int i=1;i<=m;i++){
		f[i][0]=next_num<lint>();
		cnt[i]=0;
		ldep[i]=ldep[i-1]+(i==(i&-i));
		for(int j=0;j<ldep[i];j++){
			f[i][j+1]=min(f[i][j],f[i-(1<<j)][j]);
		}
	}
	f[0][0]=n;
	cnt[m]=1;
	for(;m>=1;m--){
		if(cnt[m]==0)continue;
		lint val=f[m][0];
		for(int i=m;i=gpre(i-1,val),cnt[i]+=val/f[i][0]*cnt[m],val%=f[i][0],i>0;);
		b[1]+=cnt[m],b[val+1]-=cnt[m];
	}
	b[1]+=cnt[0];
	for(int i=1;i<=n;i++){
		printf("%lld\n",b[i]+=b[i-1]);
	}
	return 0;
}

Measured memory_bytes: 19328
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
      
      String S = sc.next();
      int lose = S.replaceAll("o","").length();
      
      if(lose < 8) {
        System.out.println("YES");
      }else{
        System.out.println("NO");
      }        
    }
}

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

int main()
{
	string s;
	while(cin>>s){
		int num[4];
		num[0]=num[1]=num[2]=num[3]=0;
		for(int i=0;i<s.size();i++){
			if(s[i]=='K') num[0]++;
			if(s[i]=='U') num[1]++;
			if(s[i]=='P') num[2]++;
			if(s[i]=='C') num[3]++;
		}
		int res=100000;
		res=min(num[0],res);
		res=min(num[1],res);
		res=min(num[2],res);
		res=min(num[3],res);
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstdio>
#include <cstdlib>

using namespace std;

typedef unsigned long long int ull;

constexpr ull mod = 1000000007;

int main(int argc,char** argv) {
	int n;
	string s[2],q;
	cin >> n >> s[0] >> s[1];
	for(int i = 0;i < n;i++) {
		if(s[0][i] == s[1][i]) q.append("V");
		else {
			q.append("H");
			i++;
		}
	}
	ull res = 0;
	if(q[0] == 'V') res = 3;
	else res = 6;
	for(int i = 1;i < q.size();i++) {
		if(q[i] == 'V') {
			if(q[i-1] == 'V') res = res * 2;
			else res = res * 1;
		} else {
			if(q[i-1] == 'V') res = res * 2;
			else res = res * 3;
		}
		res = res % mod;
	}
	cout << res;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n, a;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a;
        if(a % 2 == 0){
            if(a % 3 != 0 && a % 5 != 0){
                cout << "DENIED";
                return 0;
            }
        }
    }
    cout << "APPROVED";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}

void solve(){
	ll n, a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b);
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl

int main(){
	int n,k;
	cin>>n>>k;
	int ans=0;
	REP(i,100){
		if(pow(k,i)<=n&&pow(k,i+1)>n){
			ans=i+1;
			break;
		}
	}
	OUT(ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;

int main() {
  string s;
  int q, u = 0;
  cin >> s >> q;
  deque<char> d;
  rep(i, s.size()) d.push_back(s[i]);
  rep(i, q){
    int e;
    cin >> e;
    if(e == 1) ++u;
    else if(e == 2){
      int f;
      cin >> f;
      char c;
      cin >> c;
      if((f == 1 && u % 2 == 0) || (f == 2 && u % 2 == 1)) d.push_front(c);
      else d.push_back(c);
    }
  }
  if(u % 2 == 1){
    rrep(i, d.size()){
      cout << d.back();
      d.pop_back();
    }
    cout << endl;
  }
  else{
    rrep(i, d.size()){
      cout << d.front();
      d.pop_front();
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 896
n = int(input())
P =[]
s = 0
for _ in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for j in range(n):s += P[j][1]*P[j+1][0] -  P[j][0] * P[j+1][1]
print(-s*0.5)

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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	map<ll, ll> mp;
	int n, k;
	cin >> n >> k;
	rep(i, n){
		int a;
		cin >> a;
		mp[a]++;
	}
	
	if(mp.size() <= k){
		cout << 0 << endl;
		return 0;
	}
	
	vector<ll> tmp;
	for(auto itr : mp){
		tmp.push_back(itr.second);
	}
	
	sort(tmp.begin(), tmp.end());
	
	ll ans = 0;
	for(int i = 0; i < mp.size() - k; ++i){
		ans += tmp[i];
	}
	
	cout << ans << endl;
	
	return 0;
}



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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int n,m;
vector<int> to[100001];
bitset<100001> used;
vector<int> v;

int main(){
  cin >> n >> m;
  for(int i = 0; i < m; ++i){
    int a,b;  cin >> a >> b;
    a--;b--;
    to[a].emplace_back(b);
    to[b].emplace_back(a);
  }
  v.resize(n);
  queue<P<int,int>> que;
  que.emplace(0,0);
  while(!que.empty()){
    auto [pos,par] = que.front();
    que.pop();
    if(used[pos])continue;
    used[pos] = 1;
    v[pos] = par;
    for(auto e:to[pos]){
      que.emplace(e,pos);
    }
  }
  cout << "Yes" << endl;
  for(int i = 1; i < n; ++i){
    cout << v[i]+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 12072
#include <string>
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    const bool b1 = (s.size() % 2 == 0);
    const bool b2 = (s[0] == s[s.size() - 1]);
    if (b1 xor b2) {
        cout << "Second" << endl;
    } else {
        cout << "First" << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
int o[2010][2010];
int vsum[2010][2010];
int eusum[2010][2010];
int edsum[2010][2010];
int main() {
    int n, m, Q;
    scanf("%d %d %d", &n, &m, &Q);
    for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) {
        scanf("%1d",&o[i][j]);
        vsum[i][j] += o[i][j] + vsum[i-1][j] + vsum[i][j-1] - vsum[i-1][j-1];
        if(o[i-1][j] && o[i][j]) eusum[i][j]++;
        if(o[i][j-1] && o[i][j]) edsum[i][j]++;
        eusum[i][j] += eusum[i-1][j] + eusum[i][j-1] - eusum[i-1][j-1];
        edsum[i][j] += edsum[i-1][j] + edsum[i][j-1] - edsum[i-1][j-1];
    }
    for(int i = 0; i < Q; i++) {
        int x1, y1, x2, y2;
        scanf("%d %d %d %d",&x1, &y1, &x2, &y2);
        int tmp = vsum[x2][y2] - vsum[x1 - 1][y2] - vsum[x2][y1 - 1] + vsum[x1 - 1][y1 - 1];
        tmp -= eusum[x2][y2] - eusum[x1][y2] - eusum[x2][y1 - 1] + eusum[x1][y1-1];
        tmp -= edsum[x2][y2] - edsum[x1-1][y2] - edsum[x2][y1] + edsum[x1-1][y1];
        printf("%d\n",tmp);
    }
    return 0;
}

Measured memory_bytes: 64768
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for dy in range(n-m+1):
    for dx in range(n-m+1):
        flag = True
        for row in range(m):
            for col in range(m):
                if b[row][col] != a[dy+row][dx+col]:
                    flag = False
        if flag:
            print("Yes")
            exit()
print("No")




Measured memory_bytes: 40176
# coding: utf-8

N = int(input())
S = input()

def kanou(s, i1, i2, i3):
    target = [i1, i2, i3]
    target_iter = target.__iter__()
    now = next(target_iter)
    for c in s:
        if c == now:
            try:
                now = next(target_iter)
            except StopIteration:
                return True
    return False

res = 0
for i in range(0, 1000):
    if i <= 9:
        i1 = "0"
        i2 = "0"
        i3 = str(i)
    elif i <= 99:
        tmp = str(i)
        i1 = "0"
        i2 = tmp[0]
        i3 = tmp[1]
    else:
        tmp = str(i)
        i1 = tmp[0]
        i2 = tmp[1]
        i3 = tmp[2]
    if kanou(S, i1, i2, i3):
        res += 1

print(res)


Measured memory_bytes: 9172
#include <stdio.h>

int main(void) {
  int n, ans = 0, l, r, i;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%d%d", &l, &r);
    ans += r - l + 1;
  }
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
ll ans,n;
void dfs(ll cur, int v3 ,int v5 ,int v7){
if (cur<=n&&v3&&v5&&v7) ans++;
if(cur>n) return;
dfs(cur*10+3,1,v5,v7);
dfs(cur*10+5,v3,1,v7);
dfs(cur*10+7,v3,v5,1);
}
int main() {
cin>>n;
dfs(0,0,0,0);
cout<<ans;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
typedef pair<ll  ,ll > pll;
 
const ll maxn =5e5;
const ld SADAT = 7.84e-17;
const ll INF = 1e18;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);
 
#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define all(x) x.begin() , x.end()
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define random_init mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ms(x , y) memset(x , y , sizeof x);
#define prnt(x)  for(int i = 0 ; i < x.size() ; i ++) cout << x[i] << ' ';
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}
 
int n;
int p[10] , q[10] , ans[10];
 
bool ok(int x[]){
    for (int i  = 1 ; i <= n ; i ++){
        if(ans[i]!=x[i]) return(0);
    }
    return(1);
}
 
int main(){
    migmig
    cin >> n;
    for (int i  = 1 ; i <= n ; i  ++){
        cin >> p[i];
    }
 
    for (int i  = 1 ; i <= n ; i  ++){
        cin >> q[i];
    }
 
    for (int i  = 1 ; i <= n ; i  ++){
        ans[i]  =i;
    }
    int cnt = 1  , i = -1 , j = -1;
    while(1){
        if(ok(p)){
            i = cnt;
        }
        if(ok(q)){
            j = cnt;
        }
        if(i > 0 and j > 0){
            dokme(abs(i - j));
        }
        next_permutation(ans + 1 , ans + n + 1);
        cnt++;
    }
    return(0);
}
 
 
//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		List<Integer>p = new ArrayList<>();
		int a = 0;
		int min = 101;
		for(int i = 0; i < n; i++)
			p.add(sc.nextInt());
		for(int i = -1; i <= 200; i++){
			if(!p.contains(i) && Math.abs(i - x) < min){
				a = i;
				min = Math.abs(i - x);
			}
		}
		System.out.print(a);
	}
}


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

using namespace std;
using ll = long long;

typedef pair<int, int> pii;

#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define ff first
#define ss second

int main() {
    // read;
    // write;
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) {
        string s;
        cin >> s;
        if (s == "ABC") {
            cout << "ARC\n";
        } else cout << "ABC\n";
    }

    return 0;
}

Measured memory_bytes: 3656
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS

vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int n,m,k;
cin>>n>>m>>k;
int f = 0;
for(int i=0;i<=n;i++) {
    for(int j=0;j<=m;j++) 
    if(i*m + n*j == k + 2*i*j){
        debug(i,j);
        f = 1;
        break;
    }
    if(f) break;
}
if(f ) cout<<"Yes";
else cout<<"No";
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 256