akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main()
{

  int a,b;

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

  if(a < b) printf("a < b\n");

  if(a > b) printf("a > b\n",a,b);

  if(a == b) printf("a == b\n",a,b);

  return 0;

}

Measured memory_bytes: 580
// Created by ahmed_drawy on 10/09/19.
///dp educational contest atcoder - vjudge
#include <bits/stdc++.h>
#include <string.h>
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
using namespace std;
#define lp(i,start , end)       for(int i = start ; i<end ; ++i)
#define lllp(i,start , end)       for(ll i = start ; i<end ; ++i)
#define inN(arr ,  n) for(int i = 0 ; i< n ; ++i)  cin>>arr[i];
#define Rlp(i,start , end)      for(int i = start ; i>end ; --i)
#define all(v)                   ((v).begin(),(v).end())
#define sz(v)                  (int)((v).size())
#define clr(v,d)                memset(v , d , sizeof(v))
#define inf 0x3f3f3f3f
//#define dbg (v)    for(auto it : v)cout<<it<<' ';
typedef long long               ll;
typedef vector<int>             vi;
typedef vector  <ll>            vll;
typedef vector<vector<int> >    adj;
typedef pair<int ,int>          pii;
const double EPS =1e-7;
const int OO = 1e6;
#define endl '\n'
#define cint(c) (int)c -'0';
#define itc(c) (char)c +'A';
bool sortpair( const pair<int , int> & x, const pair<int , int> & y){
    return  x.first != y.first ? x.first < y.first : x.second > y.second ;
}
int dcomp(double x , double y){
    return fabs(x-y) <= EPS? 0: x>y?1:-1;
}

void smile() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
//    freopen("/home/tw3/Desktop/Desktop/training/in.txt", "r", stdin);
//    freopen("/home/tw3/Desktop/Desktop/training/out.txt" , "w" , stdout);
#endif
}
#define fastin smile()

int n , w;
const int N = 1e5 +3;
ll dp[100][N];
ll w8[101];
ll cost[101];
ll knapsack(int indx , int rem){
    if(indx == n )
        return 0 ;
    ll &ret = dp[indx][rem];
    if(~ret)
        return ret;
    ret = knapsack(indx+1 , rem);
    if(w8[indx] <= rem)
        ret = max(ret , cost[indx] + knapsack(indx+1 , rem - w8[indx]) );
    return ret;



}
int main() {
    fastin;
    cin >>  n  >> w;
    for (int i = 0; i <n ; ++i) {
        cin >>w8[i]>>cost[i];
    }
    clr(dp , -1);
    cout<< knapsack(0,w);
}

Measured memory_bytes: 78464
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
//#include"stdc++.h"
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

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

#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  ll n;
  cin>>n;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];

  vector<ll> total(n);
  total[0]=A[0];
  for(ll i=1;i<n;i++) total[i]=total[i-1]+A[i];
  ll ans=0;
  //for(auto x:total) if(x==0) ans++;
  map<ll,ll> m;
  for(auto x:total) m[x]++;

  for(auto p:m){

    if(p.first==0){
      ans+= (p.second)*(p.second+1)/2;
    }
    else{
      ans+= (p.second)*(p.second-1)/2;
    }

  }

  cout << ans << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

Measured memory_bytes: 15872
def main():
    n,x=map(int,input().split())
    m=[int(input()) for _ in range(n)]
    sum_m=sum(m)
    min_m=min(m)
    ans=len(m)
    x-=sum_m
    ans+=x//min_m
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9124
F = [int(input()) for k in range(5)]
t = 0
r = 10
for k in range(5):
    if F[k]%10 != 0:
        if F[k]%10 < r:
            r = F[k]%10
            t = k
ans = 0
for k in range(5):
    if k == t or F[k]%10 == 0:
        ans += F[k]
    else:
        ans += F[k] + (10-F[k]%10)
print(ans)


Measured memory_bytes: 3060
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll K, N;
    cin >> K >> N;
    vector<ll> A;
    rep(i, N)
    {
        ll a;
        cin >> a;
        A.push_back(a);
    }
    //
    //sort(A);
    // 一番間隔があいているところを探す
    ll maxDist = 0;
    ll maxDistIdx = -1;
    rep(i, N)
    {
        ll a0 = A[i];
        ll a1 = A[(i + 1) % N];
        if (a1 < a0)
        {
            a1 += K;
            maxDistIdx = i;
        }
        chmax(maxDist, a1 - a0);
    }
    //
    ll ans = K - maxDist;
    cout << ans;

    return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <vector>
#include <string>

using namespace std;

static const int kModulo = 1000 * 1000 * 1000 + 7;

int main() {
    ios::sync_with_stdio(false);
    int H, W; cin >> H >> W;

    vector<string> A(H);
    for (int i = 0; i < H; ++i)
        cin >> A[i];

    vector< vector<int> > dp(H, vector<int>(W, 0));
    dp[0][0] = 1;
    for (int i = 0; i < H; ++i)
        for (int j = 0; j < W; ++j) {
            if (A[i][j] == '#')
                continue;
            if (i + 1 < H)
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % kModulo;
            if (j + 1 < W)
                dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % kModulo;
        }
    cout << dp[H - 1][W - 1] << "\n";
}



Measured memory_bytes: 5760
import java.util.*;
public class Main {

    private static boolean check(int[] arr, int num) {
        String str = String.valueOf(num);
    
        for(int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            int nu = Character.getNumericValue(c);
            
            for(int j = 0; j < arr.length; j++) {
                int val = arr[j];   
                
                if (nu == val) {
                    return false;
                }
            }
            
        }
        return true; 
    }

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] arr = new int[K];
        for (int i = 0; i < K; i++) {
            arr[i] = sc.nextInt();
        }

        int ans = N;
        while(true) {
            if (check(arr, ans)) {
                break;
            }
            ans++;
        }
        System.out.println(ans);
    }
}	

Measured memory_bytes: 25620
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 100000 + 5;
const int M = 3000 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

String s;
std::stack<char> stk;
int ans;

int main() {
    std::cin >> s;
    int n = s.length();
    for (int i = 0; i < n; i++) {
        if (s[i] == '0') {
            if (!stk.empty() && stk.top() == '1') {
                ans += 2;
                stk.pop();
            } else {
                stk.push(s[i]);
            }
        } else {
            if (!stk.empty() && stk.top() == '0') {
                ans += 2;
                stk.pop();
            } else {
                stk.push(s[i]);
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 512
N, P = map(int, input().split())
As = list(map(int, input().split()))
even = 0
odd = 0
for a in As:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

E = 2**even
if P == 0:
    O = 1
    o = 1
    for i in range(2, odd+1, 2):
        o = int(o*(odd+1-i)*(odd+2-i)/i/(i-1))
        O += o
else:
    O = odd
    o = odd
    for i in range(3, odd+1, 2):
        o = int(o*(odd+1-i)*(odd+2-i)/i/(i-1))
        O += o
print(E*O)

Measured memory_bytes: 3064
import math

a,b,h,m=map(int,input().split())

theta_h=float((math.pi * h) / 6 + (math.pi * m) / 360)
theta_m=float((math.pi * m) / 30)

x_2=float(a**2+b**2-2*a*b*math.cos(abs(theta_h-theta_m)))
x=math.sqrt(x_2)
print(x)

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
int main(){
  int num;
  double ans,tmp;
  double *box;
  cin >> num;
  cin.ignore();
  box = new double[num];
  for(int i=0;i<num;i++){
    cin >> box[i];
  }
  for(int i=0;i<num-1;i++){
    for(int j=0;j<num-1;j++){
      if(box[j]>box[j+1]){
        tmp = box[j];
        box[j] = box[j+1];
        box[j+1] = tmp;
      }
    }
  }
  
  for(int i=1;i<=num;i++){
    box[i] = (box[i-1]+box[i])/2;
  }
  cout << box[num-1] << endl;
}

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

#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
typedef pair<ll,ll> pll;

const int N = 2e5+2;
ll n, k;
ll ar[N], pos[N];

int main()
{
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (ll i = 1; i <= n; i++)
    {
        cin >> ar[i];
    }
    memset(pos,-1,sizeof(pos));
    vector<ll> v;
    ll ls, sz, cyc, idx;
    for (ll i = 1, j = 0; pos[i] == -1; i = ar[i], j++)
    {
        v.pb(i);
        pos[i] = j;
        ls = ar[i];
        sz = j+1;
    }
    cyc = pos[ls];
    sz -= cyc;
    if (cyc == 0)
        idx = k % sz;
    else
    {
        idx = (k-cyc+sz) % sz;
        idx += cyc;
        if (k <= cyc)
            idx = k;
    }
    // cout << "k   : " << k%sz << '\n';
    // cout << "cyc : " << cyc << '\n';
    // cout << "sz  : " << sz << '\n';
    // cout << "idx : " << idx << '\n';
    // cout << "seq : ";
    // for (ll i : v)
    // {
    //     cout << i << ' ';
    // }
    // cout << '\n';
    cout << v[idx] << '\n';
    return 0;
}

Measured memory_bytes: 8484
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        
        Scanner s=new Scanner(System.in);
        
        int n=s.nextInt();
        int ts = 0;
        int hs = 0;
        for(int i=0; i<n;i++){
            String t = s.next();
            String h = s.next();
            if(0<h.compareTo(t)){
                hs=hs+3;
            }
            if(0<t.compareTo(h)){
                ts=ts+3;
            }
            if(0==t.compareTo(h)){
                ts=ts+1;
                hs=hs+1;
            }
        }
        System.out.println(ts+" "+hs);
    }
}


Measured memory_bytes: 29072
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = INF+7;
const ll LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb push_back

int main(){
    int N;
    string S[2];
    cin >> N >> S[0] >> S[1];
    map<char,bool> used;

    long ans = 1;
    if(S[0][0] == S[1][0]){
        ans *= 3;
        used[S[0][0]] = true;
    }
    else if(S[0][0] == S[0][1]){
        ans *= 6;
        used[S[0][0]] = true;
        used[S[1][0]] = true;
    }

    for(int i=1;i<N;++i){
        if(used[S[0][i]]) continue;

        if(S[0][i] == S[1][i]){
            if(S[0][i-1] == S[1][i-1]) ans = 2*ans%MOD;
            used[S[0][i]] = true; 
        }
        else if(S[0][i] == S[0][i+1]){
            used[S[0][i]] = true;
            used[S[1][i]] = true;
            if(S[0][i-1] != S[1][i-1]) ans = 3*ans%MOD;
            else ans = 2*ans%MOD;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void dbg_out(){
	cerr<<endl;
}
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){
	cerr<<' '<< H; 
	dbg_out(T...);
}
int const MAXN=100100, MOD=1e9+7;
#define ll long long
vector<int> tree[MAXN];
ll w[MAXN], b[MAXN], n;
void dp(int node, int parent){
	w[node]=b[node]=1;
	for(int x:tree[node])
		if(x!=parent){
			dp(x,node);
			b[node]=(b[node]*w[x])%MOD;
			w[node]=((w[x]+b[x])%MOD*w[node])%MOD;
		}
	//dbg(node,parent,b[node],w[node]);	
}
int main(){
	cin>>n;
	for(int i=0;i<n-1;i++){
		int a, b;
		cin>>a>>b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	dp(1,0);
	cout<<(w[1]+b[1])%MOD;
}


Measured memory_bytes: 10240
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int[] input = new int[5];
		for (int i = 0; i < 5; i++) {
			input[i] = sc.nextInt();
		}
		for (int i = 0; i < 5; i++) {
			if (input[i] == 0) {
				System.out.println(i + 1);
			}
		}

	}
}

Measured memory_bytes: 35716
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
 
#define N 600000
#define NIL -1
 
//array
int key[N];
int parent[N];
int leftc[N];
int rightc[N];
 
//root
int root=NIL;
 
//function insert
void insert(int z){
  int x,y;
   
  y=NIL;
  x=root;
 
  while(x!=NIL){
    y=x;
    if(key[z]<key[x]) x=leftc[x];
    else x=rightc[x];
  }  
   
  parent[z]=y;
 
  if(y==NIL) root=z;
     
  else if(key[z]<key[y]) leftc[y]=z;
  
  else rightc[y]=z;
   
   
}
 
//print
void inorderprint(int now){
  if(now!=NIL){
    inorderprint(leftc[now]);
    printf(" %d",key[now]);
    inorderprint(rightc[now]);
  }
}
 
void preorderprint(int now){
  if(now!=NIL){
    printf(" %d",key[now]);
    preorderprint(leftc[now]);
    preorderprint(rightc[now]);
  }
}
 
 
 
int main(){
 
  int n,i,j,data;
  int z=0;
  char str[10];
  //initialize array
  for(i=0;i<N;i++){
    parent[i]=NIL;
    key[i]=NIL;
    rightc[i]=NIL;
    leftc[i]=NIL;
  }
  //load numbaer
  scanf("%d",&n);
 
  //load command
  for(i=0;i<n;i++){
    scanf("%s",str);
    if(strcmp(str,"insert")==0) {
      scanf("%d",&data);
      key[z]=data;
      insert(z);
      z++;
    }
    else if(strcmp(str,"print")==0){
      inorderprint(root);
      cout <<endl;
      preorderprint(root);
      cout <<endl;
    }
  }
 
  return 0;
}

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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  int count = 0;
  
  if(A >= K) {
    for(int i = 0; i < K; i++) {
      count++;
    }
  }
  
  if((A + B) >= K && K > A) {
    for(int i = 0; i < A; i++) {
      count++;
    }
  }
  
  if(K > (A + B)) {
    for(int i = 0; i < A; i++) {
      count++;
    }
    for(int j = 0; j < K - (A + B); j++) {
      count--;
    }
  }
  
  cout << count << endl;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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;
  string s;
  int q;
  cin >> n >> s >> q;

  vector<set<int>> vec(26);
  rep(i, n) vec[s[i]-'a'].insert(i);
  vector<int> ans;
  rep(I, q) {
    int num; cin >> num;
    if(num == 1) {
      int i;
      char c;
      cin >> i >> c;
      --i;
      char from = s[i];
      vec[from-'a'].erase(i);
      vec[c-'a'].insert(i);
      s[i] = c;
    }
    else {
      int l, r; cin >> l >> r; --l; --r;
      int res = 0;
      rep(i, 26) {
        if(vec[i].lower_bound(l) != vec[i].upper_bound(r)) ++res;
      }
      ans.push_back(res);
    }
  }
  for(auto x : ans) cout << x << endl;
}


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

using namespace std;

long long mod(long long n, int m){
    return ((n % m) + m) % m;
}

int main(){
    long long n;
    cin >> n;
    string ans = "";
    long long checkint = 1;
    do{
        switch(mod(n / abs(checkint), 2)){
        case 0:
            ans = "0" + ans;
            break;
        case 1:
            ans = "1" + ans;
            n -= checkint;
            break;
        }
        checkint *= -2;
    }while(n);
    cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        StringBuilder debug = new StringBuilder();
        Scanner sc = new Scanner(System.in);
        int period = sc.nextInt();//D
        debug.append(period+"\n");

        int[] cost = new int[26];//c
        long debugSumCost = 0L;
        for (int i = 0;i<cost.length;++i)
        {
            cost[i] = sc.nextInt();
            debug.append(cost[i]+" ");
            debugSumCost += cost[i];
        }
        debug.append("\n");
        //System.err.println("debugSumCost = "+debugSumCost);

        int[][] score = new int[period][26];//s
        for (int i = 0;i<score.length;++i)
        {
            for (int j = 0;j<score[i].length;++j)
            {
                score[i][j] = sc.nextInt();
                debug.append(score[i][j]+" ");
            }
            debug.append("\n");
        }

        //System.err.println(debug.toString());

        Map<Integer,Integer> lastDay = new HashMap<>();//contestType,lastDay
        for (int type = 0;type < 26;++type) lastDay.put(type,0);

        long satisfaction = 0L;
        for (int date = 0;date < period;++date)
        {
            //select
            long maxSatisfaction = Long.MIN_VALUE;
            int bestContestType = -1;
            for (int type = 0;type < 26;++type)
            {
                long tmpSatisfaction = satisfaction + score[date][type];
                long tmpMinus = 0L;
                for (int t = 0;t < 26;++t)
                {
                    if (type == t) continue;
                    tmpMinus += cost[t] * ((date+1) - lastDay.get(t));
                }
                tmpSatisfaction -= tmpMinus;

                if (maxSatisfaction < tmpSatisfaction)
                {
                    maxSatisfaction = tmpSatisfaction;
                    bestContestType = type;
                }
            }
            System.err.println(maxSatisfaction);

            //calc
            satisfaction = maxSatisfaction;
            lastDay.put(bestContestType,(date+1));

            //output
            System.out.println(bestContestType+1);
        }
        System.err.println(satisfaction);
        sc.close();
    }
}

Measured memory_bytes: 49816
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int N, A, P, Q;

int find(int numerator, int denominator, int preIndex, int depth, int curr_a)
{
	if (depth > N || curr_a > A || numerator * Q > P * denominator)
		return 0;
	else if (numerator * Q == denominator * P)
		return 1;
	else
	{
		int counter = 0;
		for (int i = preIndex; i <= A / curr_a; i++)
		{
			counter += find(i * numerator + denominator, denominator * i, i, depth + 1, curr_a * i);
		}
		return counter;
	}
}

int main(int argc, char const *argv[])
{
	int i = 0;
	for (int p, q, a, n, out; scanf("%d %d %d %d", &p, &q, &a, &n) && a != 0; printf("%d\n", out))
	{
		out = 0;
		N = n;
		A = a;
		P = p;
		Q = q;
		out = find(0, 1, 1, 0, 1);
	}
	return 0;
}



Measured memory_bytes: 2020
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N, K, d, a;
	cin >> N >> K;
	vector<bool> A(N);
	for (int i = 0; i < K; i++) {
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> a;
			A[a - 1] = true;
		}
	}
	cout << count(A.begin(), A.end(), false) << endl;
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()
using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;

int main(void){
	int N ,M; cin>>N>>M;
	string a[N],b[M];
	rep(i ,N)cin>>a[i];
	rep(j ,M)cin>>b[j];
	bool jud = false;
	int cnt = 0;

	for(int t = 0; t < N - M + 1; t++){
		for(int k = 0; k < N - M + 1; k++){
			cnt = 0;
			for(int s = 0; s < M; s++){
				for(int q = 0; q < M; q++){
					if(a[t + s][k + q] == b[s][q])cnt++;
				}
			}
			if(cnt == M * M){
				jud = true;
			}
		}
	}

	cout<<(jud?"Yes":"No");

}


Measured memory_bytes: 256
N,K=map(int,input().split())
s=input()
g=[]
l=0
for i in range(1,N):
    if s[i]!=s[i-1]:
        g.append(i-l)
        l=i
g.append(N-l)

M=len(g)
ans=0
S=[0]
for h in range(M):
    S.append(S[h]+g[h])

if s[0]=="0":
    if K>M//2:
        print(N)
    else:
        for j in range(M):
            if j+2*K+1>M:
                break
            elif j==0:
                ans=max(ans,S[j+2*K]-S[j])
            elif j%2==1:
                ans=max(ans,S[j+2*K+1]-S[j])
        ans=max(ans,S[M]-S[M-2*K])
        print(ans)
    
else:
    if K>=M//2+M%2:
        print(N)
    else:
        for j in range(M):
            if j+2*K+1>M:
                break
            elif j%2==0:
                ans=max(ans,S[j+2*K+1]-S[j])
        ans=max(ans,S[M]-S[M-2*K])
        print(ans)

Measured memory_bytes: 8052
//In the name of GOD
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define pb push_back
#define Mp make_pair
#define pll pair<ll, ll>
#define F first
#define S second

ll a, b;
string s;

int main(){
	fast_io;
	
	cin >> a >> s;
	b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
	cout << (a * b) / 100;
	
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
#define inf 0x3f3f3f3f
#define N 1000010
using namespace std;
int vis[N];

int main(){
    int k;
    scanf("%d",&k);
    int sum=0;
    for(int i=1;i<=1000000000;i++)
    {
        sum=(sum*10+7)%k;
        if(sum==0)
        {
            printf("%d\n",i);
            return 0;
        }
        if(vis[sum])
        {
            printf("-1\n");
            return 0;
        }
        vis[sum]=1;
    }
	return 0;
}


Measured memory_bytes: 7596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;

int main(){
  long long n;
  cin >> n;
  long long x = n;
  int sum = 0;
  while(x > 0){
    sum += x % 10;
    x /= 10;
  }
  if(n % sum == 0){cout << "Yes" << endl;}
  else{cout << "No" << endl;}
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int maxn=10000+10;
struct dong{
    int id,x,ca;
    friend bool operator <(dong a,dong b){
        return a.x<b.x;
    }
} d[maxn*2];
int h[maxn*10],go[maxn*100],nxt[maxn*100],dfn[maxn*10],low[maxn*10],sta[maxn*10],belong[maxn*10];
int left[maxn*10],right[maxn*10],leaf[maxn*2],a[maxn],b[maxn],c[maxn*2];
bool bz[maxn*10],pd[maxn*10];
int i,j,k,l,r,mid,t,n,m,tot,top,num,sum,euler,root;
void build(int &x,int l,int r){
    if (!x) x=++tot;
    if (l==r){
        leaf[l]=x;
        return;
    }
    int mid=(l+r)/2;
    build(left[x],l,mid);build(right[x],mid+1,r);
}
void add(int x,int y){
    go[++tot]=y;
    nxt[tot]=h[x];
    h[x]=tot;
}
void link(int x,int l,int r)
{
    if (l==r) return;
    add(x,left[x]);add(x,right[x]);
    int mid=(l+r)/2;
    link(left[x],l,mid);link(right[x],mid+1,r);
}
void insert(int x,int l,int r,int a,int b,int id)
{
    if (a>b) return;
    if(l==a && r==b)
	{
        add(id,x);
        return;
    }
    int mid=(l+r)/2;
    if (b<=mid) insert(left[x],l,mid,a,b,id);
    else if (a>mid) insert(right[x],mid+1,r,a,b,id);
    else{
        insert(left[x],l,mid,a,mid,id);
        insert(right[x],mid+1,r,mid+1,b,id);
    }
}
void ins(int id,int x,int ans)
{
    int le,ri;
    int l,r,mid;
    l=x;r=2*n;
    while(l<r)
	{
        mid=(l+r+1)/2;
        if (c[mid]-c[x]<ans) l=mid;else r=mid-1;
    }
    ri=l;
    l=1;r=x;
    while(l<r){
        mid=(l+r)/2;
        if (c[x]-c[mid]<ans) r=mid;else l=mid+1;
    }
    le=l;
    insert(root,1,2*n,le,x-1,id);
    insert(root,1,2*n,x+1,ri,id);
}
void tarjan(int x)
{
    bz[x]=1;
    dfn[x]=low[x]=++euler;
    sta[++top]=x;
    pd[x]=1;
    int t=h[x];
    while (t){
        if (!bz[go[t]]){
            tarjan(go[t]);
            low[x]=min(low[x],low[go[t]]);
        }
        else if (pd[go[t]]) low[x]=min(low[x],dfn[go[t]]);
        t=nxt[t];
    }
    if (dfn[x]==low[x]){
        sum++;
        do{
            pd[sta[top]]=0;
            belong[sta[top]]=sum;
            top--;
        }while (sta[top+1]!=x);
    }
}
bool check(int ans)
{
    tot=0;
    fo(i,1,num) h[i]=0;
    link(root,1,2*n);
    fo(i,1,n){
        add(leaf[b[i]],i*2-1);
        add(leaf[a[i]],i*2);
        ins(i*2-1,a[i],ans);
        ins(i*2,b[i],ans);
    }
    top=euler=sum=0;
    fo(i,1,num) bz[i]=pd[i]=0;
    fo(i,1,num)
        if (!bz[i]) tarjan(i);
    fo(i,1,n)
        if (belong[i*2-1]==belong[i*2]) return 0;
    return 1;
}
int main()
{
    scanf("%d",&n);
    fo(i,1,n)
	{
        scanf("%d%d",&a[i],&b[i]);
        d[i*2-1].x=a[i];
        d[i*2-1].ca=0;
        d[i*2].x=b[i];
        d[i*2].ca=1;
        d[i*2-1].id=d[i*2].id=i;
    }
    sort(d+1,d+2*n+1);
    fo(i,1,2*n)
	{
        if (d[i].ca==0) a[d[i].id]=i;else b[d[i].id]=i;
        c[i]=d[i].x;
    }
    tot=2*n;
    build(root,1,2*n);
    num=tot;
    l=0;r=1000000000;
    while (l<r)
	{
        mid=(l+r+1)/2;
        if (check(mid)) l=mid;else r=mid-1;
    }
    printf("%d\n",l);
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  ll a; cin >> a;
  string b; cin >> b;
  
  b.replace(1,1,"");
  ll ib = stoll(b);
  ll ans = a*ib/100;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

//最小公倍数
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int N;
int AC=0,WA=0,TLE=0,RE=0;
int main(){
    cin>>N;
    for(int i=0;i<N;++i){
        string S;
        cin>>S;
        if(S=="AC")AC++;
        else if(S=="WA")WA++;
        else if(S=="TLE")TLE++;
        else if(S=="RE")RE++;
    }
    cout<<"AC x "<<AC<<endl;
    cout<<"WA x "<<WA<<endl;
    cout<<"TLE x "<<TLE<<endl;
    cout<<"RE x "<<RE<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
    int n;
    cin>>n;
    
    int sum=0;
    int c=1;
    while(sum<n){
        sum+=c;
        c++;
    }
    sum-=n;
    vector<int> v;
    for(int i=1;i<c;i++){
        if(i!=sum)v.pb(i);
    }
    rep(i,v.size()){
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
    
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i=0;i<A.length;i++) {
			A[i] = sc.nextInt();
		}

		int v,j;
		for(int x=0;x<A.length;x++) {

			int AN= A.length;
			System.out.print(A[x]);
			if(AN-1!=x) {
				System.out.print(" ");
				}
			}
		System.out.println();
		for(int i=1;i<A.length;i++) {
			 v = A[i];
			 j = i - 1;
			while(j >= 0 && A[j] > v) {
				A[j+1] = A[j];
				j--;
				A[j+1] = v;
			}
			for(int x=0;x<A.length;x++) {

				int AN= A.length;
				System.out.print(A[x]);
				if(AN-1!=x) {
					System.out.print(" ");
					}
				}
			System.out.println();
		}
		sc.close();


	}

}



Measured memory_bytes: 34340
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;
int main()
{
	int a,b,c;
	cin >> a; cin >> b; cin >> c;
	
	int temp = a;
	a = b; b = temp;
	
	temp = a;
	a = c; c = temp;
	cout << a; cout << " ";
	cout << b; cout << " "; 
	cout << c;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
const double EPS = 1e-10;//sample:if((double)>=(double)+EPS)
#define CLR(a) memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)  cerr << #x << " = " << (x) << endl;//debug
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);


using namespace std;

int main(){
  int n,a;
  cin>>n;
  int A[100000]={};
  for(int i=0;i<n;i++){
    cin>>a;
    A[a]++;
  }
  for(int i=0,cnt=0;i<100000;i++)
    for(int j=0;j<A[i];j++,cnt++){
      if(cnt!=0)
	printf(" ");
      printf("%d",i);
    }
  cout<<endl;
  return 0;
}



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

int main(){
int K,S;
  cin >>K>>S;
  int ans=0;
  for(int x=0;x<=K;x++){
    for(int y=0;y<=K;y++){
      int z=S-x-y;
      if(0<=z and z<=K){
        ans++;
     }
    }
  }
    cout <<ans<<endl;
return 0;
}

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

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

int main()
{
	string op;
	cin >> op;

	string s;
	rep(i, op.size())
	{
		if (op[i] == '0')
		{
			s.push_back('0');
		}
		else if (op[i] == '1')
		{
			s.push_back('1');
		}
		else
		{
			if (!s.empty())
			{
				s.pop_back();
			}
		}
	}

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#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 Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

const int INF = 1e9+7;

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

struct UnionFind{
private:
    vector<int> par;

public:
    UnionFind(int n=0): par(n,-1){ }

    int find(int x){
        if(par[x]<0) return x;
        else return par[x] = find(par[x]);
    }

    bool same(int x,int y){
        return find(x)==find(y);
    }

    bool unite(int x, int y){
        x = find(x); y = find(y);
        if(x==y) return false;
        if(par[x]>par[y]) swap(x,y);
        par[x]+=par[y];
        par[y] = x;
        return true;
    }

    int size(int x){
        return -par[find(x)];
    }

    int count_group(){
        int c = 0;
        rep(i,par.size()){
            if(par[i]<0) c++; 
        }
        return c;
    }
};

int main(){
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> ed(m);
    rep(i,m){
        cin >> ed[i].first >> ed[i].second;
        ed[i].first--;
        ed[i].second--;
    }
    int ans = 0;
    rep(i,m){
        UnionFind uf(n);
        rep(j,m){
            if(i==j) continue;
            uf.unite(ed[j].first,ed[j].second);
        }
        if(!uf.same(ed[i].first,ed[i].second)){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,ans;
string a,b,c;
int main(){
	cin>>n;
	cin>>a>>b>>c;
	
	for(int i=0; i<n; i++){
		ans += 2;
		ans -= (a[i] == b[i]) + (b[i] == c[i]) + (a[i] == c[i]);
		if(a[i] == b[i] && b[i] == c[i])ans++;
	}
	
	cout << ans;
	
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

class P
{
    static void Main()
    {
        int[] nx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int x = nx[1];
        int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(p => p).ToArray();
        int count = 0;
        for (int i = 0; i < a.Length; i++)
        {
            x -= a[i];
            if (x < 0)
            {
                Console.WriteLine(count);
                return;
            }
            else
            {
                count++;
            }
        }
        if (x > 0) count--;
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13396
from collections import deque

n = int(input())
a = list(map(int, input().split()))
b = deque()
turn = 1
for ai in a:
    if turn:
        b.append(ai)
    else:
        b.appendleft(ai)
    turn = (turn + 1) & 1

if n % 2:
    b = list(b)[::-1]
print(*b)


Measured memory_bytes: 25412
#include<bits/stdc++.h>
using namespace std;
#define pb  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;
const int N = (int)1e5 + 9;
const int MOD = 1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)1e18;
const double PI = acos(-1.0);


bool isprime(ll n) {
	if (n <= 1)
		return 0;
	for (ll i = 2; i*i <= n; i++)
		if (n%i == 0)
			return false;
	return 1;
}
ll intlog(ll base, ll x) {
	return (log(x) / log(base));
}
bool prime[N];
void primee()
{

	for (int p = 2; p*p <= N; p++)
	{

		if (prime[p] == true)
		{
			for (int i = p * 2; i < N; i += p)
				prime[i] = false;
		}
	}

}
string decToBinary(ll n)
{
	string z = "";
	int i = 0;
	while (n > 0) {

		z += (n % 2) + 48;
		n = n / 2;
		i++;
	}
	reverse(all(z));
	return z;
}
ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a%b);
}
ll power(ll x, int y)
{
	ll temp;
	if (y == 0)
		return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return x * temp*temp;
}
int main()
{
	int n, h, w, ans = 0;
	scanf("%d %d %d", &n, &h, &w);
	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= n; j++)
		{
			if (i + h <= n && j + w <= n) ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def main():
    n,k = inpl()
    xary = []; yary = []
    a = []
    x_append = xary.append
    y_append = yary.append
    a_append = a.append
    for i in range(n):
        x,y = inpl()
        x_append(x)
        y_append(y)
        a_append((x,y))
    xary.sort(); yary.sort()
    res = INF
    for xi in range(n-1):
        for xj in range(xi+1,n):
            for yi in range(n-1):
                for yj in range(yi+1,n):
                    cnt = 0
                    l = xary[xi]; r = xary[xj]
                    d = yary[yi]; u = yary[yj]
                    # print(l,r,d,u)
                    for i in range(n):
                        x,y = a[i]
                        if l<=x<=r and d<=y<=u:
                            cnt += 1
                    if cnt >= k:
                        res = min(res, (r-l)*(u-d))
    print(res)
if __name__ == "__main__":
    main()

Measured memory_bytes: 73176
#include <iostream>
using namespace std;
bool IsPrime(int n){
	for(int i=2;i*i<=n;i++){
		if(n%i==0){
			return false;
		}
	}
	return true;
}
int main(void){
	int count=0,n;
	cin>>n;
	for(int i=0;i<n;i++){
		int p;
		cin>>p;
		if(IsPrime(p)){
			count++;
		}
	}
	cout<<count<<endl;
	return 0;
}


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



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    ll x;
//    x=1ll << 59;
//    ll y=(1ll << 59) - 1ll;
//    cout<<((double)(x)==(double)(x-1))<<endl;
    string a,b,c,d;
    ll x,y,s=0;
    cin>>x>>y;
    for(int i=x;i<=y;i++){
        a=to_string(i);b=a;
        //reverse(a.begin(),a.end());
        if(a[0]==a[4]&&a[1]==a[3])s++;
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3708
import java.util.*;

public class Main{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int n = sc.nextInt();
        // 配列の宣言
        int[] a = new int[n];
        int sum = 0;
        int[] answer = new int[n];
        answer[0] = 0;
        int ans_sum = 0;
        // for文
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
            sum += a[i];
            if(i == n - 1) break;
            answer[i + 1] = a[i] * 2 - answer[i];
            ans_sum += answer[i + 1];
        }

        //int[] answer = new int[n];
        //for(int i = 0; i < sum; i += 2){
            //answer[0] = 0;
            //int ans_sum = 0;
            /*for(int j = 1; j < n; j++){
                answer[j] = a[j - 1] * 2 - answer[j - 1];
                ans_sum += answer[j];
            }*/
            //if(ans_sum == sum) break;
        //}

        int o = sum - ans_sum;
        /*if(ans_sum != sum){
            answer[0] = o;
            //ans_sum = answer[0];
            /*for(int j = 1; j < n; j++){
                if(j % 2 == 0) answer[j] += o;
                else answer[j] -= o;
                //ans_sum += answer[j];
            }
        }*/

        String s = "";
        for(int i = 0; i < n; i++){
            if(i % 2 == 0) System.out.print((answer[i] + o) + " ");
            else System.out.print((answer[i] - o) + " ");
        }

        // 出力
        System.out.println();

    }

}


Measured memory_bytes: 72344
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
cnt = Counter(a)
if n%2 == 0:
    for key in cnt.keys():
        if key%2 and key < n and cnt[key] == 2:
            continue
        else:
            print(0)
            quit()
    print((2**(n//2)) % mod)
else:
    for key in cnt.keys():
        if key % 2 == 0 and key < n and cnt[key] == 2:
            continue
        elif key == 0 and cnt[key] == 1:
            continue
        else:
            print(0)
            quit()
    print((2**(n//2)) % mod)

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<P> A(M);
    rep(i, M) cin >> A.at(i).first >> A.at(i).second, A.at(i).first--;
    for (int i = 0; i <= 2000; i++)
    {
        string s = to_string(i);
        if(s.size()==N){
            bool l = true;
            rep(j,M){
            if(s.at(A.at(j).first)-'0'!=A.at(j).second){
                l = false;
                }
            }
        if (l){
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}

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

int main(){
    
    int n, m, l;
    cin >> n >> m >> l;
    
    long long A[n][m];
    for(int i=0; i<n; i+=1){
        for(int j=0; j<m; j+=1){
            cin >> A[i][j];
        }
    }
    
    long long B[m][l];
    for(int j=0; j<m; j+=1){
        for(int k=0; k<l; k+=1){
            cin >> B[j][k];
        }
    }
    
    long long C[n][l];
    for(int i=0; i<n; i+=1){
        for(int k=0; k<l; k+=1){
            long long S=0;
            for(int j=0; j<m; j+=1){
                S = S + (A[i][j] * B[j][k]);
                
            }
            C[i][k] = S;
        }
    }
    
    for(int i=0; i<n; i+=1){
        for(int k=0; k<l; k+=1){
            if(k) cout << " ";
            cout << C[i][k];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3232
#include <iostream>

using namespace std;
int n;
int main()
{
    cin>>n;
    int v[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    int maxx=v[1],ans=0;
    for(int i=1;i<=n;i++)
    {
        if(maxx<=v[i])
        {
            ans++;
            maxx=v[i];
        }
    }
    cout<<ans;
    return 0;
}


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

int main()
{
    string s;
    cin>>s;
    int l = s.length();
    string s1 = s.substr(0,l-((l-1)/2)-1);
    string s2 = s.substr(((l+3)/2)-1);

    if (
        (s == string(s.rbegin(), s.rend()) ) && 
        (s1 == string(s1.rbegin(), s1.rend()) ) && 
        (s2 == string(s2.rbegin(), s2.rend()) )
        ) {
        cout<<"Yes";
    } else cout<<"No";

    return 0;
}


Measured memory_bytes: 256