akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;

using namespace std;

int main(void){
    string In;
    static int HFill[2005][2005], WFill[2005][2005];
    static bool isFill[2005][2005];
    int H, W;
    MEMSET(WFill, 0);
    MEMSET(HFill, 0);
    MEMSET(isFill, true);
    cin >> H >> W;
    int k;
    rep(i, H+2){
        //cout << i << endl;
        if(i == 0) continue;
        if(i == H+1){
            rep(j, W+2){
                if(j == 0) continue;
                for(k = j-1; isFill[i][k] == false; k--)
                    WFill[i][k] = WFill[i][j-1];
                for(k = i-1; isFill[k][j] == false; k--)
                    HFill[k][j] = HFill[i-1][j];
               
                /*cout << "WFill" << endl;
                rep(t, H+2){
                    rep(s, W+2){
                        cout << WFill[t][s] << ":";
                    }
                    cout << endl;
                }
                cout << endl;
                cout << "HFill" << endl;
                rep(t, H+2){
                    rep(s, W+2){
                        cout << HFill[t][s] << ":";
                    }
                    cout << endl;
                }
                cout << endl;*/
            }
            break;
        }
        
        //cout << i << endl;
        
        cin >> In;
        In = "#" + In+ "#";
        rep(j, W+2){
            if(j == 0) continue;
            if(In[j] =='.') isFill[i][j] = false;
            if(isFill[i][j] == false){
                WFill[i][j] = WFill[i][j-1]+1;
                HFill[i][j] = HFill[i-1][j]+1;
            } else{
                /*rep(t, H+2){
                    rep(s, W+2){
                        cout << (isFill[t][s] ? "#": ".");
                    }
                    cout << endl;
                }
                cout << endl;*/
                
                for(k = j-1; isFill[i][k] == false; k--)
                    WFill[i][k] = WFill[i][j-1];
                for(k = i-1; isFill[k][j] == false; k--)
                    HFill[k][j] = HFill[i-1][j];
                
                /*cout << "WFill" << endl;
                rep(t, H+2){
                 rep(s, W+2){
                     cout << WFill[t][s] << ":";
                 }
                 cout << endl;
                 }
                 cout << endl;
                cout << "HFill" << endl;
                rep(t, H+2){
                 rep(s, W+2){
                     cout << HFill[t][s] << ":";
                 }
                 cout << endl;
                 }
                 cout << endl;*/
            }
            
            
            
        }
    }
    int Maxim=0;
    rep(i, H+2){
        rep(j, W+2){
            Maxim = max(Maxim, HFill[i][j] + WFill[i][j]-1);
        }
    }
    cout << Maxim << endl;
    return 0;
}



Measured memory_bytes: 35584
#include<iostream>
#include<map>
#include<string>
#include<vector>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<string> v(3);
  for(int i=0;i<3;i++) cin>>v[i];
  int ans=0;
  for(int i=0;i<n;i++){
    //cout<<v[0][i]<<" "<<v[1][i]<<" "<<v[2][i]<<endl;
    if(v[0][i]==v[1][i]){
      if(v[0][i]!=v[2][i])
        ans++;
    }
    else{
      if(v[2][i]==v[1][i]||v[2][i]==v[0][i])
        ans++;
      else ans+=2;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  string ans;
  while(N) {
    N--;
    ans.push_back('a'+(N%26));
    N /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout<<ans<<endl;
}


Measured memory_bytes: 3596
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1,c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return (string)s; }
string to_string(string s) { return s; }
template<class A> string to_string(complex<A> c) { 
	stringstream ss; ss << c; return ss.str(); }
string to_string(vector<bool> v) { 
	string res = "{"; for(int i = 0; i < (int)v.size(); i++) res += char('0'+v[i]);
	res += "}"; return res; }
template<size_t SZ> string to_string(bitset<SZ> b) {
	string res = ""; for(size_t i = 0; i < SZ; i++) res += char('0'+b[i]);
	return res; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) { // containers with begin(), end()
	bool fst = 1; string res = "{";
	for (const auto& x: v) {
		if (!fst) res += ", ";
		fst = 0; res += to_string(x);
	}
	res += "}"; return res;
}
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define wis(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__)
#else
#define wis(...) 0
#endif
typedef long long ll;
const int MOD = 1e9 + 7, INF = 1e9 + 5;
inline ll powmod(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)res=res*a%MOD;return res;}
inline ll power(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a)if(b&1)res=res*a;return res;}

const int MAXN = 2e5 + 10;

int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll k, a, b, c;
	cin >> a >> b >> c >> k;
	while(k--){
		if(a >= b)
			b *= 2;
		else
			c *= 2;
	}
	if(c > b && b > a)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll n, m; cin >> n >> m;
    vector<pll> AB(n);
    rep(i, n){
        ll a, b; cin >> a >> b;
        AB[i] = {a, b};
    }
    sort(AB.begin(), AB.end());

    ll res = 0;
    for(const auto& p : AB){
        ll a, b; tie(a, b) = p;
        ll buy = min(m, b);
        m -= buy;
        res += a * buy;
    }
    cout << res << endl;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    N = int(input())
    cnt = 0

    res = []
    def rec(n, i, k):
        if k == 1:
            res.append(n+i*(10**(k-1)))
            return
        rec(n+i*(10**(k-1)), 3, k-1)
        rec(n+i*(10**(k-1)), 5, k-1)
        rec(n+i*(10**(k-1)), 7, k-1)

    for l in range(3, len(str(N))+1):
        rec(0, 3, l)
        rec(0, 5, l)
        rec(0, 7, l)

    cnt = 0
    for on in res:
        if on > N:
            break
        found = True
        seven = False
        five = False
        three = False
        n = on
        for j in range(len(str(on))):
            a = int(n % 10)
            n /= 10
            if a != 7 and a != 5 and a != 3:
                found = False
            if a == 7:
                seven = True
            if a == 5:
                five = True
            if a == 3:
                three = True
        if found and seven and five and three:
            cnt += 1
    print(cnt)

main()


Measured memory_bytes: 4340
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 100005
#define int long long
ll p[maxn],q[maxn],r[maxn];
int x,y,c,a,b;
#pragma GCC optimize(2)
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>x>>y>>a>>b>>c;
    for (int k = 1; k <maxn ; ++k) {
        p[k]=q[k]=r[k]=20000000000;
    }
    for (int i = 1; i <=a ; ++i) {
        cin>>p[i];
    }
    for (int i = 1; i <=b ; ++i) {
        cin>>q[i];
    }
    for (int i = 1; i <=c ; ++i) {
        cin>>r[i];
    }
    sort(p+1,p+1+a);
    sort(q+1,q+1+b);
    sort(r+1,r+1+c);
    ll ans=0;
    int cnt=0;
    for (int j = a; j >=1 ; --j) {
        ans+=p[j];
        cnt++;
        if(cnt==x)break;
    }
    cnt=0;
    for (int j = b; j >=1 ; --j) {
        ans+=q[j];
        cnt++;
        if(cnt==y)break;
    }
    int l=a-x+1,rs=b-y+1;
    int pos=c;
    while(pos>=1){
        if(l>a&&rs>b)break;
        if(r[pos]<=q[rs]&&r[pos]<=p[l])break;
        if(q[rs]<=p[l]&&r[pos]>q[rs]){
            ans-=q[rs];
            rs++;
            ans+=r[pos];
            pos--;
        }else{
            if(r[pos]>p[l]){
                ans-=p[l];
                l++;
                ans+=r[pos];
                pos--;}
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 2560
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::HashMap;

fn main() {
	input! {
		n: usize,
		a: [usize; n],
	}

	let mut nums = HashMap::new();
	for i in 0..n {
		let count = nums.entry(a[i]).or_insert(0usize);
		*count += 1;
	}
	let mut ans = 0;
	for (_k, v) in &nums {
		if v % 2 == 1 {
			ans += 1;
		}
	}
	println!("{}", ans);
}



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

#define N 1005

using namespace std;

int ans;

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	char a,b,c;
	cin>>a>>b>>c;
	ans=700;
	if(a=='o')
	ans+=100;
	if(b=='o')
	ans+=100;
	if(c=='o')
	ans+=100;
}

int main(){
	init();
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int min = 1000000000;
				
		int[] trees = new int[n];
		for(int i=0;i<n;i++) {
			trees[i] = sc.nextInt();
		}
		Arrays.sort(trees);
		
		for(int i=0;i<n-k+1;i++) {
			min = Math.min(min, trees[i+k-1] - trees[i]);
		}
		System.out.println(min);
	sc.close();
	}

}


Measured memory_bytes: 50876
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10e+6

using namespace std;

int main(){
    int p,q,r;
    cin >> p >> q >>r;
    int ans=min(p+q,p+r);
    ans=min(ans,q+r);
    cout << ans << endl;
}


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

int main() {
  string s;
  cin >> s;
  for(int i = 0; i < 3; i++){
    if(s[i] == '1'){
      cout << 9;
    }else{
      cout << 1;
    }
  }
  cout << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  }
  vector<int> dp(n + 1, INT_MAX);
  dp[0] = 0;
  for (int i = 0; i < n; ++i) {
    if (i + 1 < n) {
      dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
    }
    if (i + 2 < n) {
      dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
    }
  }
  cout << dp[n-1] << '\n';
  return 0;
}


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

int main(){
	int a, b;
	char op;
	
	while(1){
		cin >> a >> op >> b;
		if(op=='?')
			break;
		else if(op=='+')
			cout << a+b << endl;
		else if(op=='-')
			cout << a-b << endl;
		else if(op=='*')
			cout << a*b << endl;
		else if(op=='/')
			cout << a/b << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}
  
int main() {
  int n, x, y;
  cin >> n >> x >> y;
  int N = n -y+x;
  n--;
  x--; 
  y--;
  vector<int> ky(n+1);
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n+1; j++) {
      if ((i<= x &&j <= x) || (j>y&&i > y)) {
        ky[j-i]++;
      }
      else if (j <= y && j > x && i <= x) {
        int m = min(j-i, (x-i+1+y-j));
        ky[m]++;
      }
      else if (j <= y && j > x && i > x && i <= y) {
        int m = min(j-i, (i-x+1+y-j));
        ky[m]++;
      }
      else if (j > y && i > x && i <= y) {
        int m = min(j-i, (i-x+1+j-y));
        ky[m]++;
      }
      else {
        ky[x-i+1+j-y]++;
      }
    }
  }
  for (int i = 1; i < n+1; i++) {
    cout << ky[i] <<endl;
  }
} 



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
 /* int ans=-1;
  ld t_8;
  ld t_10;
  cin>>t_8>>t_10;
  int pmin8=t_8*25/2;
  int pmax8=(t_8+1)*25/2-1;
  int p10=t_10*10;
  while(p10<(t_10+1)*10){
    
    if(pmin8<=p10&&p10<=pmax8){ans=p10;break;}
    p10++;
  }*/  
  double n,m;
  cin>>n>>m;
  int ans=-1;
  rep(i,1009){
    if(floor(i*0.08)==n&&floor(i*0.10)==m){ans=i;break;}}
  cout<<ans<<endl;
}


Measured memory_bytes: 256
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cassert>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


int main() {
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    ll n;ll k;
    cin>>n>>k;
    ll sum=0;
    rep1(b,n){
        sum+=max(0ll,b-k)*(n/b);
        sum+=max(0ll,n%b-k+1);
    }
    if(k==0)sum=n*n;
    cout<<sum<<endl;
}

Measured memory_bytes: 3584
def main():
    n, m = map(int, input().split())
    if n == 1 and m == 1:
        print(1)
        return
    if n == 1 or m == 1:
        print(max(n, m) - 2)
        return
    print((n - 2) * (m - 2))


if __name__ == '__main__':
    main()


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

int main() {
	int N;
	cin >> N;
	typedef pair<long long, pair<int, int>> HP;
	vector<HP> Happiness(N);
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		Happiness[i] = { (long long)a + b,{a,b} };
	}
	sort(Happiness.begin(), Happiness.end(), greater<HP>());
	long long Taka = 0, Aoki = 0;
	for (int i = 0; i < N; i += 2) Taka += Happiness[i].second.first;
	for (int i = 1; i < N; i += 2) Aoki += Happiness[i].second.second;
	cout << Taka - Aoki << endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  constexpr int N = 600;
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  cin >> s;
  vector<vector<bool>> v(N, vector<bool>(N));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      v[i - j + w][i + j] = (s[i][j] == '#');
    }
  }
  int64_t res = 0;
  for (int x = 0; x < 4; ++x) {
    for (int d = 2; d < N; d += 2) {
      for (int i = 0; i + d < N; ++i) {
        int c = 0;
        for (int j = 0; j < d; ++j) c += v[i + d][j];
        for (int j = 0; j + d < 600; ++j) {
          if (v[i][j] && v[i][j + d]) res += c;
          c += v[i + d][j + d];
          c -= v[i + d][j];
        }
      }
    }
    auto u = v;
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < N; ++j) {
        v[i][j] = u[N - j - 1][i];
      }
    }
  }
  cout << res << endl;
}



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

int main(){
  int n,q,cnt=0;
  scanf("%d",&n);
  int s[n];
  for(int i=0;i<n;i++)
    scanf("%d",&s[i]);
  sort(s,s+n);
  scanf("%d",&q);
  int t[q];
  for(int i=0;i<q;i++)
    scanf("%d",&t[i]);
  for(int i=0;i<q;i++)
    if(binary_search(s,s+n,t[i])==true) cnt++;
   printf("%d\n",cnt);
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  const int S = N/1000;  
  const int H = (N - S * 1000)/100;    
  const int T = (N - S * 1000 - H * 100)/10;    
  const int I = (N - S * 1000 - H * 100 - T * 10);     
  
  if(S == H && H == T || H == T && T == I){
    std::cout << "Yes" << std::endl;
  }else{
    std::cout << "No" << std::endl;
  }
}

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

int main()
{
	ll N, M, Q;
	string S, B;
	while (cin >> N >> M >> Q, N | M | Q) {
		vector<ll> able(M, (1ll << N) - 1);
		ll s = 0;
		for (ll i = 0; i < Q; i++) {
			cin >> S >> B;
			for (ll j = 0; j < N; j++) {
				if (S[j] == '1') {
					s ^= 1ll << j;
				}
			}
			for (ll j = 0; j < M; j++) {
				if (B[j] == '1') {
					able[j] &= s;
				}
				else {
					able[j] &= ~s;
				}
			}
		}
		for (ll i = 0; i < M; i++) {
			ll res = -1;
			for (ll j = 0; j < N; j++) {
				if (able[i] == (1ll << j)) {
					res = j;
					break;
				}
			}
			if (res == -1) {
				cout << '?';
			}
			else if (res < 10) {
				cout << res;
			}
			else {
				cout << (char)(res - 10 + 'A');
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

int n;
map < pair<int, int>, int > mp;
long long ans;

int main() { 

  cin >> n;

  for (int i = 1; i <= n; i++) {
    int lst = i % 10;
    int cur = i;
    while (cur >= 10) {
      cur /= 10;
    }
    mp[{cur, lst}]++;
  }

  for (int i = 1; i <= n; i++) {
    int lst = i % 10;
    int cur = i;
    while (cur >= 10) {
      cur /= 10;
    }
    ans += mp[{lst, cur}];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000009
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
#define top(i,j) val[i*m+j]
#define s(a,b) strcmp(a,b)
typedef long long lli;
typedef unsigned short int usi;

int main()
{
    int i, n, a[10], max=0, sum=0;
    scanf("%d",&n);
    for(i=0; i<n; i++) {
        scanf("%d",a+i);
        sum += a[i];
        max = MAX(max,a[i]);
    }
    sum -= max;
    printf(max<sum?"Yes":"No");


    return 0;
}


Measured memory_bytes: 128
// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
    "1000" => "ABC",
    "2000" => "ARC",
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        x: u32,
    }

    if x < 1200 {
        return String::from("ABC");
    } else {
        return String::from("ARC"); 
    }
}

Measured memory_bytes: 4352
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 = sc.nextInt();
		int B = sc.nextInt();
		int modsum=0;
		int sum=0;
		for(int a=1;a<=N;a++) {
			modsum = modsum(a);
			if(A<=modsum&&modsum<=B) {
				sum += a;
			}
		}
		System.out.println(sum);
	}
	public static int modsum(int n){
		int modsum = 0;
		while(n!=0) {
		    modsum += n % 10;
		    n /= 10;
		}
	 return modsum;
	}
}

Measured memory_bytes: 21844
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program{
    static void Main(){
        int n = int.Parse(Console.ReadLine());
        int[] T = Console.ReadLine().Split(' ')
                                         .Select(val => int.Parse(val))
                                         .ToArray();
        int[] A = Console.ReadLine().Split(' ')
                                         .Select(val => int.Parse(val))
                                         .ToArray();
        long pat = 1;
        for (int i = 0; i < n; i++)
        {
            if(i == 0 || T[i - 1] != T[i]){
                if(T[i] > A[i]) pat = 0;
                else Console.Error.WriteLine("h{0} = {1}", i, T[i]);
            }
            if(i == n - 1 || A[i] != A[i + 1]){
                if(T[i] < A[i]) pat = 0;
                else Console.Error.WriteLine("h{0} = {1}", i, A[i]);
            }
            if(i != 0 && i != n - 1 && T[i - 1] == T[i] && A[i] == A[i + 1]){
                Console.Error.WriteLine("T[{0}] = {1}, A[{0}] = {2}", i, T[i], A[i]);
                pat *= Math.Min(T[i], A[i]);
                pat %= (long)(Math.Pow(10, 9) + 7);
            }
            if(pat == 0) break;
        }
        Console.WriteLine(pat);
    }
}


Measured memory_bytes: 26808
#https://atcoder.jp/contests/abc143/tasks/abc143_c
N =int(input())
S =str(input())
cnt = 1
moji = S[0]
for i in range(1,N):
    if S[i] != moji:
        cnt += 1
        moji = S[i]

print(cnt)    
    
    




Measured memory_bytes: 9176
// {{{ Template for Competitive Programming
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n; i >= 0; --i)
#define ALL(x) (x).begin(),(x).end()

const int INF = 1'010'000'000'000'000'017LL;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0 ,1 ,0,-1};

using vint = vector<int>;
using pint = pair<int, int>;
// }}}

signed main() {
	int n;
	cin >> n;
	vint h(n), dp(n);
	for (auto &e : h) cin >> e;
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	
	for (int i = 2; i < n; ++i) {
		dp[i] = min(dp[i-2] + abs(h[i-2] - h[i]), dp[i-1] + abs(h[i-1] - h[i]));
	}

	cout << dp[n-1] << endl;
}



Measured memory_bytes: 1792
using System;
using System.Linq;

namespace TaskD
{
    class Program
    {
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine()
                .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                .Select(long.Parse)
                .ToArray();
            var n = numbers[0];
            var k = numbers[1];

            var towns = Console.ReadLine()
                .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                .Select(long.Parse)
                .ToList();

            towns.Insert(0, 0);

            var visitedTowns = Enumerable.Repeat(-1L, towns.Count).ToArray();

            var townVisited = 0L;
            var currTown = 1L;
            while (visitedTowns[currTown] == -1 && townVisited < k)
            {
                visitedTowns[currTown] = townVisited;
                currTown = towns[(int)currTown];
                townVisited++;
            }

            if (townVisited == k)
            {
                Console.WriteLine(currTown);
            }
            else
            {
                var beforeLoop = visitedTowns[currTown];
                var loop = townVisited - beforeLoop;
                var steps = (k - beforeLoop) % loop + beforeLoop;

                visitedTowns = Enumerable.Repeat(-1L, towns.Count).ToArray();

                townVisited = 0L;
                currTown = 1L;
                while (visitedTowns[currTown] == -1 && townVisited < steps)
                {
                    visitedTowns[currTown] = townVisited;
                    currTown = towns[(int)currTown];
                    townVisited++;
                }

                Console.WriteLine(currTown);
            }

        }
    }
}


Measured memory_bytes: 48484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

int main(){
    ll H,W,N;
    cin >> H >> W >> N;
    ll sr,sc;
    cin >> sr >> sc;
    ll gr=H-sr+1,gc=W-sc+1;
    string S,T;
    cin >> S >> T;
    bool ans=true;
    rep(i,N){
        if (S[i]=='L'){
            sc--;
        }
        else if (S[i]=='R'){
            gc--;
        }
        else if (S[i]=='U'){
            sr--;
        }
        else {
            gr--;
        }
        if (sc==0||gc==0||sr==0||gr==0){
            ans=false;
            break;
        }
        if (T[i]=='L'&&gc<W){
            gc++;
        }
        else if (T[i]=='R'&&sc<W){
            sc++;
        }
        else if (T[i]=='U'&&gr<H){
            gr++;
        }
        else if (T[i]=='D'&&sr<H){
            sr++;
        }
    }
    if (ans){
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 776
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    vector<int> l;
    cin >> n;
    for(int i = 0; i < 2 * n; i++){
        int in;
        cin >> in;
        l.push_back(in);
    }
    sort(l.begin(), l.end());
    int answer = 0;
    while(!l.empty()){
        int in;
        l.pop_back();
        if(l.empty()){
            break;
        }
        answer += l.back();
        l.pop_back();
    }
    cout << answer << endl;
    return 0;
}

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

int main(){
	int n, m, p;
	while (1){
		cin >> n >> m >> p;
		if (n == 0 && m == 0 && p == 0) break;
		int sum = 0;
		int winner;
		for (int i = 1; i <= n; i++){
			int c;
			cin >> c;
			if (i == m){
				winner = c;
			}
			sum += c;
		}

		if (winner == 0){
			cout << 0 << endl;
			continue;
		}
		int ans = floor((sum * 100 * (100 - p) / 100) / winner);
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int n ;
	cin>>n ;
	int arr[n+1] , now[n+1];
	for(int i = 1 ; i <= n ; ++i)
		cin>>arr[i] ;
	memset(now , 0 , sizeof(now)) ;
	vector<int>v ;
	for(int i = n ; i >= 1 ; --i)
	{
		int sum = 0 ;
		for(int j = i+i ; j <= n ; j += i)
			sum += now[j] ;
		if(sum % 2 != arr[i] % 2)
			v.push_back(i) , now[i]++ ;
	}
	cout<<v.size()<<"\n";
	for(auto &i : v)
		cout<<i<<" ";
	return 0 ;
}


Measured memory_bytes: 3192
#!/usr/bin/env python3
import sys


def solve(N: int, W: "List[int]"):
    totalWeight = 0
    s1, s2 = 0, 0
    sub_min = 0
    for i in range(N):
        totalWeight += W[i]
    sub_min = totalWeight
    
    for j in range(N):
        s1 += W[j]
        s2 = totalWeight - s1
        sub_min = min(abs(s1 - s2), sub_min)
    print(sub_min)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(){
  int l,r, ll, rr;
  cin >> l >> r;
  int d = r-l > 2019?2019:r-l;
  ll = l % 2019;
  rr = ll + d;
  //  cout << ll << "\t" << rr << endl;
  int result = 2020;
  for (int i=ll;i<rr;i++) {
    for (int j=i+1;j<=rr;j++) {
      int tmp = (i*j) % 2019;
      result = result < tmp?result:tmp;
    }
  }
  cout << result << endl;
  return(0);
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
char s[5]="2017";
char a[15];
int main()
{
	cin>>a;
	int flag=1;
	for(int i=0;i<4;i++)
	 if(a[i]!=s[i])
	 flag=0;
	 if(flag==1)
	 a[3]='8';
	 cout<<a;
	 return 0;
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main(){
  ll n, m, k, a, c=0;
  cin >> n >> m;
  vecll avec(m);
  forll(i, 0, n){
	cin >> k;
	forll(j, 0, k){
	  cin >> a;
	  avec[a-1] += 1;
	}
  }
  forll(i, 0, m){
	if (avec[i] == n)
	  c += 1;
  }
  cout << c << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	int n, m;
	cin >> n;
	vector<int> t(n);
	rep(i, n) cin >> t[i];
	int sum = accumulate(t.begin(), t.end(), 0);
	cin >> m;
	rep(i, m){
		int a, b;
		cin >> a >> b;
		a--;
		int tmp = sum + b - t[a];
		cout << tmp << endl;
	}
	
}


Measured memory_bytes: 256
s = input()
n = len(s)
c = 0
for i in range(0, n, 2):
    if s[i] == "1":
        c += 1
    if i + 1 <= n - 1:
        if s[i + 1] == "0":
            c += 1
print(min(c, n - c))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+10;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,m,fa[N][N],top[N][N],ans;
vi E[N];
bool G[N][N];

void dfs(int u,int ff,int t) {
	fa[t][u]=ff;
	for(auto v:E[u])
		if(v^ff) dfs(v,u,t);
}

void add(int x,int y) {
	if(G[x][y]||x==y) return;
	if(~top[x][y]) add(top[x][y],y);
	else if(~top[y][x]) add(top[y][x],x);
	else {
		vector<pii> e;
		for(int i=0;i<2;i++) {
			top[x][y]=y;G[x][y]=1;
			queue<int> q;q.push(y);
			while(!q.empty()) {
				int u=q.front();q.pop();
				for(auto v:E[u])
					if(v^fa[x][u]) {
						if(!~top[x][v]) top[x][v]=y,q.push(v);
						else if(G[x][v]) {
							G[x][v]=G[v][x]=0;top[x][v]=top[v][x]=-1;e.pb(mp(y,v));
						}
					}
			}
			swap(x,y);
		}
		for(auto x:e) add(x.fi,x.se);
	}
}

void dfs2(int u,int ff,int t) {
	if(top[t][u]==u) ++ans,t=u;
	for(auto v:E[u])
		if(v^ff) dfs2(v,u,t);
}

int main() {
	cin>>n>>m;
	for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),E[u].pb(v),E[v].pb(u);
	for(int i=1;i<=n;i++) dfs(i,0,i);
	memset(top,-1,sizeof(top));
	for(int i=1,u,v;i<=m;i++) u=gi(),v=gi(),add(u,v);
	for(int i=1;i<=n;i++)
		for(auto j:E[i]) dfs2(j,i,i);
	cout<<ans/2;
	return 0;
}


Measured memory_bytes: 36352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

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

int main() {
	string dec = "";
	rep(i,26) dec += (char)('a'+i);
	rep(i,26) dec += (char)('A'+i);
	int n;
	while( cin >> n, n ) {
		int k[n];
		rep(i,n) cin >> k[i];
		string in;
		cin >> in;
		int ik = 0;
		string out = "";
		rep(i, in.length()) {
			int x=0;
			while(in[i]!=dec[x]) x++;
			out += dec[(x+52-k[ik])%52];
			ik = (ik+1)%n;
		}
		cout << out << endl;
	}
	return 0;
}

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

int main()
{
	string s, t;
	cin >> s>>t;

	int n = s.length();
	int m = t.length();

	int dp[n+1][m+1];
	memset(dp, 0, sizeof(dp));

	for(int i=1; i<=n; i++)
		for(int j=1; j<= m; j++)
			if(s[i-1] == t[j-1])
				dp[i][j] = max(dp[i-1][j-1]+1, dp[i][j-1]);
			else
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);


	int i=n, j = m;
	string result = "";
	while(i>0 and j>0)
	{
		if(s[i-1] == t[j-1])
		{
			result = s[i-1] + result;
			i--;
			j--;
		}
		else if( dp[i-1][j] > dp[i][j-1])
			i--;
		else
			j--;
	}

	cout << result;

	return 0;
}

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

using namespace std;

#define fast_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define int long long
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define MOD 1000000007

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

int n, i;

signed main()
{
    fast_IO;
    int test = 1;
    // cin >> test;
    while(test--)
    {
        int x, k, d;
        cin >> x >> k >> d;
        if(x < 0)
            x *= -1;
        vector<int> vec;
        int ans = x;
        int temp = x / d;
        temp = min(temp, k);
        k -= temp;
        ans -= temp * d;
        if(k % 2 == 0)
            vec.pb(ans);
        if(k)
        {
            ans -= d;
            k--;
            if(k % 2 == 0)
                vec.pb(abs(ans));
        }
        cout << *min_element(all(vec));
    } 
    return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define N 200005
#define mod 1000000007
#define fo(n) for(int i=1;i<=n;i++)
typedef pair<int,int> pii;
typedef long long int ll;
typedef long int li;
int mod1 = 998244353;

bool isP(string s) {
    int len = s.length();
    int i=0,j=len-1;
    while(i<=j) {
        if(s[i] != s[j])  return false;
        i++; j--;
    }
    return true;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    string s;
    cin>>s;
    int len = s.length();
    string p = s.substr(0,len/2);
    bool ans = true;
    if(!isP(p)) ans = false;
    string q = s.substr(len/2+1,len/2);
    if(p != q) ans = false;
    if(ans) cout<<"Yes";
    else cout<<"No";
    return 0 ;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {

	var S string
	fmt.Scanf("%s", &S)

	if (S[0] == S[1]) && (S[1] == S[2]) && (S[2] == S[3]) {
		fmt.Println("No")
	} else if (S[0] == S[1] && S[2] == S[3]) || (S[0] == S[2] && S[1] == S[3]) || (S[0] == S[3] && S[1] == S[2]) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
using namespace std;
const int MAXn = 1e3 + 10, MOD = 1e9 + 7;

int ar[MAXn], ar2[MAXn], n, m;
long long ans = 1;

bool cmp(int a, int b) {
	return a > b;
	
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> ar[i];
	for (int i = 0; i < m; i++)
		cin >> ar2[i];
	sort(ar, ar + n, cmp);
	sort(ar2, ar2 + m, cmp);
	int ind1 = 0, ind2 = 0;
	for (int i = n * m; i >= 1; i--) {
		if (ar[ind1] == i && ar2[ind2] == i) {
			ind1++;
			ind2++;
			continue;
		}
		else if (ar[ind1] == i) {
			ind1++;
			ans = (ans * (ind2)) % MOD;
		}
		else if (ar2[ind2] == i) {
			ind2++;
			ans = (ans * (ind1)) % MOD;
		}
		else {
			ans = (ans * (ind1 * ind2 - (n * m - i))) % MOD;
		}
		if (ans <= 0)
			return cout << 0,0;
	}
	cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,a,b,s=0;
  scanf("%d%d%d",&n,&a,&b);
  for(int i=1;i<=n;i++){
    int c=0;
    for(int j=i;j;j/=10)c+=j%10;
    if(a<=c&&c<=b)s+=i;
  }
  printf("%d",s);
}

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

int main() {
	string s, t;
	getline(cin, s);
	int count = 0;
	for (int i = 0; i < s.size(); i++){
			if (s[i] >= 'A' && s[i] <= 'Z')
				s[i] += 32;
	}
	while (cin >> t){
		for (int i = 0; i < t.size(); i++){
			if (t[i] >= 'A' && t[i] <= 'Z')
				t[i] += 32;		
		}			
		if (s == t)
			count++;
	}
	cout << count << endl;
	return 0;
}


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

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

  int n;
  cin >> n;
  vector<int> bcunt(60);

  rep(i, 0, n) {
    int a;
    cin >> a;
    rep(j, 0, 60) if ((a & bits(j)) != 0) bcunt[j]++;
  }

  int ans = 0;
  rep(i, 0, 60) {
    int pls = bcunt[i] * (n - bcunt[i]) % mod1;
    pls = pls * (bits(i) % mod1) % mod1;
    ans += pls;
    ans %= mod1;
  }

  cout << ans << '\n';
  return 0;
}

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

int main(){
    int n;
    cin>>n;
    ll a; 
    cin>>a;
    ll minv=a;
    ll maxv=-1000000000;
    for(int i=1;i<n;i++){
        ll r;
        cin>>r;
        maxv=max(maxv,r-minv);
        minv=min(minv,r);
    }
    cout<<maxv<<endl;
}
            





Measured memory_bytes: 3100
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
    int n,x;cin>>x>>n;vi v(n+1,0);
    set<int>s;
    rep(i,1,n){
        cin>>v[i];
        s.insert(v[i]);
    }
    int diff=0;
    while(1){
        if(s.count(x-diff)==0){cout<<x-diff;return;}
        if(s.count(x+diff)==0){cout<<x+diff;return;}
        diff++;
    }
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3656
n,m=map(int,input().split())
switch=[]
for i in range(m):
    a=list(map(int,input().split()))
    switch.append(a[1:])
p=list(map(int,input().split()))
result=0
for i in range(1<<n):
    lst=[]
    flag=True
    for j in range(n):
        if 1&(i>>j)==1:
            lst.append(1)
        else:
            lst.append(0)
    for k in range(m):
        count=0
        for l in switch[k]:
            count+=lst[l-1]
        if count%2!=p[k]:
            flag=False
    if flag==True:
        result+=1
print(result)

Measured memory_bytes: 3316
#include<iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{     
    int n,k,cnt = 0;
    cin >> n;
    vector<int> a;
    for(int i=0;i<n;i++){
        cin >> k;
        a.push_back(k);
        
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            cnt++;
        }
    }
    if(cnt){
        cout << "NO";
    }else{
        cout << "YES";
    }


}



Measured memory_bytes: 1400
#include <iostream>
#include <cmath>
#include <iomanip>
#include <utility>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#define ll long long
         
using namespace std;
     
long long gcd(int x, int y){
     if ( x == 0 ) return y;
     
     return gcd(y%x, x);
}
     
long long lcm(int x, int y){
     if ( y == 0 ){
          return x;
     }
     
     return x*y/gcd(x, y);
}
     
int min(int a, int b){
     return a > b ? b : a;
}
     
int max(int a, int b){
     return a > b ? a : b;
}

int n,m;
int h[200005];
vector <vector <int> > g(200005);
map <pair<int, int>, bool> flag;
map <int, bool> reach;
map <int, int> uk;

int main()
{
     cin.sync_with_stdio( false );
     int n,m;
     cin>>n>>m;

     for (int i=0;i<n;i++){
          cin>>h[i];
     }

     for (int i=0;i<m;i++){
          int a,b;
          cin>>a>>b;
          if ( flag[{a, b}] == false && flag[{b, a}] == false ){
               flag[{a, b}] = flag[{b, a}] = true;
               reach[a] = reach[b] = true;

               //cout<<a<<" "<<b<<" "<<h[a]<<" "<<h[b]<<endl;
               if ( h[a-1] > h[b-1] ){
                    //cout<<a<<" OO "<<b<<endl;
                    uk[a]++;
               }else if ( h[b-1] > h[a-1] ){
                    uk[b]++;
               }

               g[a].push_back(b);
               g[b].push_back(a);
          }
     }

     int br = 0;
     for (int i=1;i<=n;i++){
          //cout<<g[i].size()<<" ALO "<<i<<endl;
          if ( reach[i] == false ){
               br++;
          }else{
               if ( g[i].size() >= 1 && uk[i] == g[i].size() ){
                    br++;
               }
          }
     }

     cout<<br<<endl;
}

Measured memory_bytes: 32252