akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    ostr << p.first << " " << p.second;
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
// vll x(n); x[i]=a;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define EPS 1e-12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

ll extgcd(ll a, ll b, ll &x, ll &y){
    if (b == 0){
        x = 1;
        y = 0;
        return a;
    }
    ll g = extgcd(b, a%b, y, x);
    y -= a/b * x;
    return g;
}

bool isprime(ll x){
    if (x == 1) return false;
    if (x == 2) return true;
    if (x % 2 == 0) return false;
    ll s = sqrt(x);
    for(ll y = 3; y <= s; y += 2){
        if (x % y == 0) return false;
    }
    return true;
}

ll divisor(ll g){
    if(isprime(g)) return 2;

    ll ans = 1;
    ll s = sqrt(g);

    if (g % 2 == 0){
        ans++;
        while(g % 2 == 0) g /= 2;
        if (g > s && isprime(g)) ans++;
    }
    for(ll y = 3; y <= s; y += 2){
        if (isprime(y)){
            if (g % y == 0){
                ans++;
                while(g % y == 0) g /= y;
                if (g > s && isprime(g)) ans++;
            }
        }
    }
    return ans;
}

int main(){
    ll a, b, ans;
    cin >> a >> b;
    ll gcd, x, y;
    gcd = extgcd(a, b, x, y);
    ans = divisor(gcd);
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll x, result = 0;
  cin >> x;
  if (x <= 6) result++;
  else {
    ll xx = x % 11;
    result = (x / 11) * 2;
    if (xx == 0) {
      cout << result << endl;
      return 0;
    }
    else if (xx <= 6) result++;
    else result += 2;
  }
  cout << result << endl;
}

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

int main(void) {
  int N;
  cin >> N;
  vector<int> A(N + 1);
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
  }
  unordered_set<int> visit;
  int now = 1;
  int answer = 0;
  while (true) {
    if (visit.count(now)) {
      cout << -1 << endl;
      return 0;
    }
    visit.emplace(now);
    now = A[now];
    ++answer;
    if (now == 2) break;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 4772
#include<iostream>
#include<algorithm>

using namespace std;
static const int MAX = 100;

void inputArray(
    int Array[],        //[out]
    int& totalCountNum  //[out]
)
{
    cin >> totalCountNum;
    for (int i = 0; i < totalCountNum; i++)
    {
        cin >> Array[i];
    }
}

void outputArray(
    const int Array[],         //[in]
    const int totalCountNum    //[in]   
)
{
    cout << Array[0];
    for (int i = 1; i < totalCountNum; i++)
    {
        cout << " " << Array[i];
    }
    cout << "\n";
}

int main()
{
    int N = 0;
    int A[MAX] = {};

    inputArray(A, N);
    outputArray(A, N);

    for (int i = 1; i < N; i++)
    {
        int v = A[i];
        int j = i - 1;

        while ((j >= 0) && (A[j] > v))
        {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;

        outputArray(A, N);
    }

    return 0;
}




Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    vector<int> dp(n,INT_MAX);
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+k;j++)
        {
            dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,a[200005];
bitset<6000005>dp;
int main(){
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    dp[0] = 1;
    for(int i=1; i<=n; i++){
        dp |= (dp << a[i]);
    }
    vector<ll>v;
    for(int i=1; i<=4000002; i++){
        if(dp[i])v.pb(i);
    }
    
    cout << v[((int)v.size()-1) / 2];
    
    
    
    
    
    return 0;
}


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


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

   int s; cin >> s;
   int l=s/100; 
   int r=s%100;
   if(1<=l and l<=12){
   	if(1<=r and r<=12) cout << "AMBIGUOUS" << endl;
   	else cout << "MMYY" << endl;
   }else{
   	if(1<=r and r <=12) cout << "YYMM" << endl;
   	else cout << "NA" << endl;
   }
}



Measured memory_bytes: 256
import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
if A[0] == 0:
  print(0)
  sys.exit()
  
ans = 1
LIMIT = 10**18

for i in range(N):
  ans *= A[i]
  if ans > LIMIT:
    print(-1)
    sys.exit()
    
print(ans)

Measured memory_bytes: 21576
def print_list(lst) :
	lst = ' '.join(list(map(str, lst)))
	print(lst)

while True:
	H,W = list(map(int, input().split()))
	if (H == 0) and (W == 0):
		break
	else:
		for n in range(0, H):
			s = ""
			for m in range(0, W):
				if (n % 2 == 1 and  m % 2 == 1 ) or (n % 2 == 0 and m % 2 == 0):
					s += "#"
				else :
					s += "."
			print(s)
		print("")

Measured memory_bytes: 7696
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int n;
	scanf("%d",&n);
	while(n){
		char line[9],line1[9],temp;
		int i,o,nline,nline1;
		scanf("%s",line);
		for(i=8;i>=0;i--){
			for(o=0;o<i;o++){
				if(line[o]<line[o+1]){
					temp=line[o];
					line[o]=line[o+1];
					line[o+1]=temp;
				}
			}
		}
		for(i=0;i<9;i++)
			line1[i]=line[7-i];
		nline=atoi(line);nline1=atoi(line1);
		printf("%d\n",nline-nline1);n--;
	}
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<functional>
#include<bits/stdc++.h>
#include<map>
#include<utility>

#define vec2c vector<vector<char>>
#define vec2i vector<vector<int>>
#define vecc vector<char>
#define vecs vector<string>
#define veci vector<int>
#define vecd vector<double>
#define vecl vector<long>
#define vecll vector<long long>
#define rep(i, n) for(int i=0; i < (int)(n); i++)
#define rrep(i, n) for(int i=(int)(n); i>=0;i--)
#define rep1e(i, n) for(int i=1; i <= (int)(n); i++)
#define rep1ne(i, n) for(int i=1; i < (int)(n); i++)

#define MAX 100010

using namespace std;

unsigned digit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
  string S;
  cin >> S;
  
  rep1e(i, S.size()) {
    if (S[i-1] == 'U' || S[i-1] == 'D') continue; 
    else if (i % 2 == 0 && S[i-1] == 'L') continue;
    else if (i % 2 != 0 && S[i-1] == 'R') continue;
    else {
      cout << "No" << endl;
      return 0;
    }
  }

	cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << "("<<i-v.begin()<<", "<<*i<<")" << " ";
  }
  return os;
}


void solve(long long H, long long N, std::vector<long long> A, std::vector<long long> B){
  vector<ll> v(H+10, 0);
  for(ll i=1; i<=H; i++) {
    ll m = 1000000000000;
    for(ll j=0; j<N; j++) {
      if(i-A[j] < 0)
	m = min(B[j], m);
      else
	m = min(v[i-A[j]]+B[j], m);
    }
    v[i] = m;
  }
  std::cout << v[H] << std::endl;
}

int main(){
  long long H;
  scanf("%lld",&H);
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  std::vector<long long> B(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
    scanf("%lld",&B[i]);
  }
  solve(H, N, std::move(A), std::move(B));
  return 0;
}



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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i=0; i<N; i++) {
        cin >> X[i];
    }

    int ans = INT32_MAX;
    for(int x=1; x<=100; x++) {
        int tmp = 0;
        for(int i=0; i<N; i++) {
            tmp += (X[i]-x) * (X[i]-x);
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//*********Abhay is awesome *************\\

#include<bits/stdc++.h>


#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define piii pair<int,pii>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repc(i,a,n) for(int i=a;i<n;++i)
#define  repd(i,a,n) for(int i=a;i>n;--i)

using namespace std;
using ll = long long;
const ll N = 3*1e5 +5 ;
const ll mod = 998244353 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;

//typedef vetor<int> vi;
ll dp[3010][3010][3];

void solve(){
	int n,s;
	cin>>n>>s;
	int a[n];
	dp[0][0][0]=1;
	rep(i,n)cin>>a[i];
	rep(i,n){
		rep(j,s+1){
			(dp[i+1][j][0]+=dp[i][j][0] )%= mod;
			(dp[i+1][j][1]+=dp[i][j][0]+dp[i][j][1]) %= mod;
			(dp[i+1][j][2]+=dp[i][j][0]+dp[i][j][1]+dp[i][j][2])%=mod;
			if(j+a[i]<=s){
				(dp[i+1][j+a[i]][1]+=dp[i][j][0]+dp[i][j][1])%= mod;
				(dp[i+1][j+a[i]][2]+=dp[i][j][0]+dp[i][j][1]) %= mod;
			}
		}
	}
	cout<<dp[n][s][2];
	return;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//#ifndef ONLINE_JUDGE
    // for getting input from input.txt
  //  freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    //freopen("output1.txt", "w", stdout);
	//#endif
	//cout<<"HEy";
	solve(); 
	return  0;
}



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


Measured memory_bytes: 211968
def binary_search(array, tgt_no): #  arrayは昇順にソートされているものとする

    def compare_midpoint(tgt, array, start, end):
        midpoint = (end + start)//2
        if tgt == array[midpoint]:
            return True, None, None
        elif tgt < array[midpoint]:
            return False, start, midpoint
        elif tgt > array[midpoint]:
            return False, midpoint, end

    start = 0
    end = len(array)
    while True:
        ret, start, end = compare_midpoint(tgt_no, array, start, end)
        if ret:
            return True
        if end - start <= 1:
            return tgt_no == array[start]


def main():
    _ = input()
    array_A = list(map(int, input().split()))
    _ = input()
    array_B = list(map(int, input().split()))

    cnt = 0
    for integer_B in array_B:
        if binary_search(array_A, integer_B):
            #print(integer_B)
            cnt += 1

    print(cnt)
    return


main()


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

int main() {
    int64_t k, a, b, x = 0;
    cin >> k >> a >> b;
    k++;
    if (a + 1 >= b) {
        cout << k << endl;
        return 0;
    }
    if (k >= a + 2) {
        x += b, k -= a + 2;
        x += (b - a) * (k / 2) + (k % 2);
    } else
        x += k;
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 3584
inp = input()
rev = inp[::-1]
num = len(inp)
harf = int(num/2)

start = inp[0:harf - 1]
end = rev[0:harf - 1]
ans = 0

if (inp == rev):
    lis_11 = inp[0:harf]
    lis_12 = rev[harf + 1:]

    if (lis_11 == lis_12):
        lis_21 = inp[harf + 1:]
        lis_22 = rev[0:harf]
        if (lis_21 == lis_22):
            ans += 1
if (ans == 1):
    print("Yes")
else:
    print("No") 

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

typedef pair<double, string> P;

int main(void) {
    while(1) {
        int n;
        scanf("%d",&n);
        if(!n) break;

        vector<P> list;
        for(int i=0; i<n; i++) {
            string l;
            int p,a,b,c,d,e,f,s,m;
            cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;

            double r = 0;
            r = (double)(m*f*s - p)/(a+b+c + m*(d+e));
            list.push_back(P(-r, l));
        }
        sort(begin(list), end(list));

        for(auto &e : list)
            cout << e.second << endl;
        cout << '#' << endl;
    }
    return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  set<int> ans;
  for(int i = 0; i < n; i++){
    int v; cin >> v;
    ans.insert(v);
  }
  cout << ans.size() << endl;
  return 0;
}
 

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

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


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int>carta;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        carta.push_back(a);
    }
    sort(carta.begin(),carta.end());
    int alice=0;
    int bob=0;
    int v=0;
    for(int i=n-1;i>=0;i--){
        if(!v){
            alice+=carta[i];
            v=1;
        }
        else{
            bob+=carta[i];
            v=0;
        }

    }
    cout << alice-bob<< endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

int f (ll n) {
    int ret = 1; while (n >>= 1) ret++;
    return ret;
}
int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x, y; cin >> x >> y;
    cout << f(y / x) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n % 2 == 0) {
        for(int i = 0; i < n/2; i++){
            if(s[i] != s[i + n/2]) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
H, W, K = map(int, input().split())
C = []
for _ in range(H):
    C.append(list(input()))

# Bit全探索
ans = 0
for hbits in range(1<<H):
    hignore = [False for __ in range(H)]
    for hi in range(H):
        if hbits & (1<<hi):
            hignore[hi] = True

    for wbits in range(1<<W):
        wignore = [False for __ in range(W)]
        for wi in range(W):
            if wbits & (1<<wi):
                wignore[wi] = True
    
        # count
        cnt = 0
        for ix in range(H):
            if hignore[ix]:
                continue
            for jx in range(W):
                if wignore[jx]:
                    continue
                if C[ix][jx] == '#':
                    cnt += 1
        
        if cnt == K:
            ans += 1

print(ans)



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

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  int flag = 1;
  for (int i = 0; i < 3; i++) {
    if (s[i] != t[2-i]) {
      flag = 0;
    }
  }
  if (flag) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
# include <stdio.h>

int main(void){
	int n,r[4],t,o,p[123];
	char s[123];
	
	scanf("%d",&n);
	
	for(t=0;t<n;t++){
		p[t]=0;
	}
	
	for(t=0;t<n;t++){
		o=0;r[0]=0;r[1]=0;r[2]=0;r[3]=0;
		while(1){
			gets(s);
			if(s[0]=='O'){
				o++;
				if(o==3){
					break;
				}
			}
			if(s[1]=='I'){
				if(r[3]==1){
					p[t]++;
					r[3]=0;
				}
				if(r[2]==1){
					r[3]=1;
					r[2]=0;
				}
				if(r[1]==1){
					r[2]=1;
				}
				r[1]=1;
			}
			if(s[1]=='O'){
				if(r[3]==1){
					p[t]++;
					r[3]=0;
				}
				if(r[2]==1){
					p[t]++;
					r[2]=0;
				}
				if(r[1]==1){
					r[1]=0;
					p[t]++;
				}
				p[t]++;
			}
		}
	}
	for(t=0;t<n;t++){
		printf("%d\n",p[t]);
	}
	
	return 0;
}
	

Measured memory_bytes: 596
// atcoder/abc130/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int x, a;
  while (cin >> x >> a) {
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;
  }

  return 0;
}


Measured memory_bytes: 892
n, q = map(int, input().split())
p = [input().split() for _ in range(n)]
t = i = 0
while n:
    i = i % n
    if int(p[i][1]) <= q:
        t += int(p[i][1])
        print(p[i][0], t)
        del p[i]
        n -= 1
    else:
        p[i][1] = int(p[i][1]) - q
        t += q
        i += 1

Measured memory_bytes: 19548
#include <stdio.h>

int main()
{
    int i,j;
    int answer;
    
    for(i=1;i<10;i++)
    {
        for(j=1;j<10;j++)
        {
            answer = i*j;
            printf("%dx%d=%d\n",i,j,answer);
        }
    }
    return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl


int main() {
    int N, M;  cin >> N >> M;
    vector<int> P(M);
    vector<ll> Y(M);
    rep(i, M) cin >> P[i] >> Y[i];

    tuple<int, ll, int> T[M];
    rep(i, M) {
        T[i] = make_tuple(P[i], Y[i], i+1);  // 県，年，初期番号
    }
    sort(T, T+M);

    int csr_p = 1;  // 県
    int csr_x = 1;  // 番目
    tuple<int, int, int> ans[M];  // 初期番号, 県, 番目
    rep(i, M) {
        if (get<0>(T[i]) == csr_p) { 
            ans[i] = make_tuple(get<2>(T[i]), get<0>(T[i]), csr_x);
            csr_x++;  // next
        } else {
            i--;
            csr_p++;  // next
            csr_x = 1;  // init
        }
    }

    sort(ans, ans+M);

    rep(i, M) {
        cout << setfill('0') << right << setw(6) << get<1>(ans[i]);
        cout << setfill('0') << right << setw(6) << get<2>(ans[i]) << endl;; 
        //print(get<0>(ans[i]) << get<1>(ans[i]) << get<2>(ans[i]));
    }


}



Measured memory_bytes: 6144
l,r = map(int,input().split())
MOD = 2019
ans = MOD

if r-l+1>=MOD:
    kouho=list(range(MOD))
else:
    kouho=[i%MOD for i in list(range(l,r+1))]
    
for i in range(len(kouho)):
    for j in range(i+1,len(kouho)):
        ans=min(ans,(kouho[i]*kouho[j])%MOD)

print(ans)


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
// const ll MOD = 1e9+7;
const ll MOD = 998244353;
const ll LINF = 1e18;

// MOD は 1000000007 とは限らない！

// https://betrue12.hateblo.jp/entry/2019/04/21/150214

// a[i]の配分の全通り数3^nから、3角形を成さない割り振り方の通り数を引く
// この通り数を求める際に重複を排除する櫃夜があるので、それをdp2から求める

const ll maxj=300*300+5;
ll dp1[305][maxj]; // i番目の辺までの色の塗り分けを決めた時 Rの長さをjとする通り数
// a[i]をRに配分するならば、dp[i+1][j+a[i]]へ遷移し、配分しないならdp[i+1][j]へ遷移する
// 後者の遷移はG,Bの二色について有り得るので*2通りとなる
// a[i]の合計をsumとするならば,j>=ceil(sum/2)について、
// dp1[n][j]の合計がある一色について着目した時に三角形がつくれない割り振り方の通り数となる

ll dp2[305][maxj]; // 2辺にしか割り振らないと決めて、i番目の辺までの色の塗り分けを決めた時 Rの長さをjとする通り数
// a[i]をRに配分するならば、dp[i+1][j+a[i]]へ遷移し、配分しないならdp[i+1][j]へ遷移する
// こちらはdp1と違いRに配分しない場合はある一色に割り当てると考えられるので*2は行わない
// sum%==2 ならば、Rの長さ=Gの長さ=sum/2 となることが有り得る
// これはdp1の3角形を成さない通り数から排除すべき重複のため、dp[n][sum/2]を求めてcomb(3,2)倍したものを引く

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll  a(n);
  ll sum=0;
  rep(i,n){
    cin>>a[i];
    sum+=a[i];
  }
  
  dp1[0][0]=dp2[0][0]=1;
  rep(i,n){
    rep(j,maxj){
      (dp1[i+1][j+a[i]]+=dp1[i][j])%=MOD;
      (dp1[i+1][j]+=(dp1[i][j]*2)%MOD)%=MOD;
      (dp2[i+1][j+a[i]]+=dp2[i][j])%=MOD;
      (dp2[i+1][j]+=dp2[i][j])%=MOD;
    }
  }
  
  ll ng=0;
  irep(j,(sum+1)/2,maxj){
    (ng+=dp1[n][j])%=MOD;
  }
  if(sum%2==0){
    (ng+=MOD-dp2[n][sum/2])%=MOD;
  }
  (ng*=3)%=MOD;
  
  ll ans=1;
  rep(i,n) (ans*=3)%=MOD;
  (ans+=MOD-ng)%=MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 427648
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
using namespace std;

#define rep(i,N) for(int i=0; i<N; i++)
#define revrep(i,N) for(int i=N-1; i>=0; i--)

typedef long long ll;
typedef unsigned int uint;

int main(void)
{
    uint N, Q;
    string S;

    cin >> N >> Q;
    cin >> S;

    vector<uint> l(Q);
    vector<uint> r(Q);
    rep(i,Q){
        cin >> l.at(i) >> r.at(i);
        l.at(i)--;
        r.at(i)--;
    }

    vector<uint> sum(N,0);
    bool flag = false;
    rep(i,N){
        if (flag && S.substr(i,1) == "C") {
            flag = false;
            sum.at(i) = sum.at(i-1) + 1;
            continue;
        }

        if (S.substr(i,1) == "A") {
            flag = true;
            if (i > 0) sum.at(i) = sum.at(i-1);
            continue;
        }

        {
            flag = false;
            if (i > 0) sum.at(i) = sum.at(i-1);
        }
    }

    //rep(i,N){
    //    cout << sum.at(i) << ", ";
    //}
    //cout << endl;
    
    rep(i,Q){
        cout << sum.at(r.at(i)) - sum.at(l.at(i)) << endl;
    }
    return 0;
}


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

int main() {
	int n,k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	int l = 0, r = 1e9;
	while (r-l > 1) {
		int x = (l+r)/2;
		auto f = [&](int x) {
			ll now = 0;
			rep(i,n) {
				now += (a[i]-1)/x;
			}
			return now <= k;
		};
		if (f(x)) r = x; else l = x;
	}
	cout << r << endl;

	return 0;
}


Measured memory_bytes: 3924
#include <stdio.h>
#include <string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

//文字から数値に変換
int getChar(char ch){
  if(ch == 'A')
   return 1;
  else if(ch == 'C')
   return 2;
  else if(ch == 'G')
   return 3;
  else if(ch == 'T')
   return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum = 0, p=1, i;

  for(i=0; i<strlen(str); i++)
  {
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){
  return key%M;
}

int h2(int key){
  return 1+(key%(M-1));
}

int find(char str[]){
  long long key, i, h;

  key=getKey(str);

  for(i=0; ; i++)
  {
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h], str) == 0)
      return 1;
    else if(strlen(H[h]) == 0)
      return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;

  key=getKey(str);

  for(i=0; ; i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h], str) == 0)
      return 1;
    else if(strlen(H[h]) == 0)
    {
      strcpy(H[h], str);
      return 0;
    }
  }
}

int main(){
  int i, n, h;
  char str[L], com[9];

  for(i=0; i<M; i++)
  {
    H[i][0] = '\0';
  }

  scanf("%d", &n);

  for(i=0; i<n; i++)
  {
    scanf("%s %s", com, str);

    if(com[0] == 'i')
    {
      insert(str);
    }
    else
    {
      if(find(str))
      {
        printf("yes\n");
      }
      else
      {
        printf("no\n");
      }
    }
  }


  return 0;
}



Measured memory_bytes: 16052
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
vector<ll> g[N];
ll val[N], vis[N];
void dfs(ll x = 1)
{
    vis[x] = 1;
    for (ll e : g[x])
        if (!vis[e])
        {
            val[e] += val[x];
            dfs(e);
        }
}
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, q, u, v;
    cin >> n >> q;
    for (ll i = 1; i < n; i++)
        cin >> u >> v, g[u].push_back(v), g[v].push_back(u);
    while (q--)
    {
        ll p, x;
        cin >> p >> x;
        val[p] += x;
    }
    dfs();
    for (ll i = 1; i <= n; i++)
        cout << val[i] << " ";
    return 0;
}

Measured memory_bytes: 45312
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC154
{
    public class QuestionD
    {
        public static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var (n, k) = (nk[0], nk[1]);
            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var pAverages = Enumerable.Range(0, n).Select(i => (p[i] - 1) * 0.5D + 1D).ToArray();
            var sums = new double[n];
            sums[0] = pAverages.Take(k).Sum();
            for (int i = 1; i < n - k + 1; i++)
            {
                sums[i] = sums[i - 1] - pAverages[i - 1] + pAverages[i - 1 + k];
            }
            Console.WriteLine(sums.Max());
        }
    }
}



Measured memory_bytes: 44064
#include<iostream>
#include <string>
#include<vector>
typedef long long ll;

using namespace std;
int main()
{
	string n;
	cin >> n;

	string kotae = "999";

	for (int i = 0; i < 3; i++) {
		if (n[i] == '9') kotae[i] = '1';
	}
	cout << kotae << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;

using Graph = vector<vector<int>>;

ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
ll mul(ll l, ll r) {
    ll ret =1;
    for(int i=0; i<l-r+1; ++i) {
        ret*=i+r;
        ret%=MOD;
    }
    return ret;
}
ll com(ll n, ll k) {
    ll ret1 = mul(n,n-k+1);
    ll ret2 = mul(k,1);
    ll ret3 = modPow(ret2, MOD-2);
    return ret1*ret3%MOD;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k; cin >> n >> k;
    vi l(n); rep(i,n) cin >> l[i];
    sort(all(l), greater<int>());
    int sum = 0;
    for(int i=0; i<k; ++i) {
        sum += l[i];
    }
    cout << sum << "\n";

}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
  int n = 0;
  
  scanf("%d", &n);
  printf("%d\n", a[n-1]);
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

	int a[100], b[100];
	for (int i = 0; i < m; i++){
		cin >> a[i] >> b[i];
	}

	int count = 0;
	int start = 1, end;
	while (1){
		end = -1;
		for (int i = 0; i < m; i++){
			if (a[i] <= start && b[i] >= start){
				if (b[i] > end){
					end = b[i];
				}
			}
		}
		if (end == -1){
			cout << "Impossible" << endl;
			break;
		}

		start = end + 1;
		count++;

		if (end > n - 1){
			cout << count << endl;
			break;
		}
		if (count == n){
			cout << "Impossible" << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

#define M 1046527
//#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch)
{
    if(ch=='A')return 1;
    else if(ch=='C') return 2;
    else if(ch=='G')return 3;
    else if(ch=='T')return 4;
    else return 0;
}

long long getKey(char str[])
{
    long long sum = 0,p = 1,i;
    for(i=0;i<strlen(str);i++)
    {
        sum += p*(getChar(str[i]));
        p*=5;
    }
    return sum;
}

int h1(int key){ return key%M;}
int h2(int key) {return 1+(key%(M-1));}

int find1(char str[])
{
    long long key,i,h;
    key = getKey(str);
    for(i=0;;i++)
    {
        h=(h1(key)+i*h2(key))%M;
        if(strcmp(H[h],str)==0) return 1;
        else if(strlen(H[h])==0) return 0;
    }
    return 0;
}

int insert1(char str[])
{
    long long key,i,h;
    key = getKey(str);
    for(i=0;;i++)
    {
        h=(h1(key)+i*h2(key))%M;
       // if(strcmp(H[h],str)==0)return 1;
   /* else */if(strlen(H[h])==0){
        strcpy(H[h],str);
       return 0;
    }
       /* if(strlen(H[h])==0)
        {
            strcpy(H[h],str);
        }*/
    }
   return 0;
}

int main()
{
    int i,n;
    char str[L],com[9];
    for(i=0;i<M;i++)
    {
        H[i][0]='\0';
    }
    cin>>n;
    for(i=0;i<n;i++)
    {
        scanf("%s %s",com,str);
        if(com[0]=='i') insert1(str);
        else if(com[0]=='f')
        {
            if(find1(str)) cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 17448
using namespace std;
#include <bits/stdc++.h>
int main(){
	long long int x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	if(x/d>=k){
		x=x-(k*d);
		cout<<x<<endl;
		return 0;
	}
	long long int y=x/d;
	k=k-y;
 x=x-y*d;
	if(k%2==0){
		cout<<x<<endl;
	}
	else{
		cout<<min(abs(x-d),abs(x+d))<<endl;
	}
	return 0;
}

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

int main()
{
  fastio;
  int n; cin >> n;
  set <int> S;
  for (int i = 1; i <= n; i++){
    int x; cin >> x;
    S.insert(x);
  }
  cout << (S.size() == n ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 9600
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    int ans=753;
    rep(i,n-2){
        string m;
        m = s.substr(i,3);
        ans = min(ans,abs(753-stoi(m)));
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>

using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PI;


void solve()
{
	int A, B, C;
	cin >> A >> B >> C;
	queue<PI> que, nextQue;
	que.push(PI(P(A, B), C));
	int cnt = 0;
	set<PI> Set;
	Set.insert(que.front());
	while (true)
	{
		while (!que.empty())
		{
			PI pi = que.front();
			que.pop();
			if (pi.first.first == pi.first.second && pi.first.first == pi.second)
			{
				goto END;
			}
			if (Set.find(PI(P(pi.first.first + 2, pi.first.second), pi.second)) == Set.end())
			{
				Set.insert(PI(P(pi.first.first + 2, pi.first.second), pi.second));
				nextQue.push(PI(P(pi.first.first + 2, pi.first.second), pi.second));
			}
			if (Set.find(PI(P(pi.first.first, pi.first.second + 2), pi.second)) == Set.end())
			{
				Set.insert(PI(P(pi.first.first, pi.first.second + 2), pi.second));
				nextQue.push(PI(P(pi.first.first, pi.first.second + 2), pi.second));
			}
			if (Set.find(PI(P(pi.first.first, pi.first.second), pi.second + 2)) == Set.end())
			{
				Set.insert(PI(P(pi.first.first, pi.first.second), pi.second + 2));
				nextQue.push(PI(P(pi.first.first, pi.first.second), pi.second + 2));
			}
			if (Set.find(PI(P(pi.first.first + 1, pi.first.second + 1), pi.second)) == Set.end())
			{
				Set.insert(PI(P(pi.first.first + 1, pi.first.second + 1), pi.second));
				nextQue.push(PI(P(pi.first.first + 1, pi.first.second + 1), pi.second));
			}
			if (Set.find(PI(P(pi.first.first + 1, pi.first.second), pi.second + 1)) == Set.end())
			{
				Set.insert(PI(P(pi.first.first + 1, pi.first.second), pi.second + 1));
				nextQue.push(PI(P(pi.first.first + 1, pi.first.second), pi.second + 1));
			}
			if (Set.find(PI(P(pi.first.first, pi.first.second + 1), pi.second + 1)) == Set.end())
			{
				Set.insert(PI(P(pi.first.first, pi.first.second + 1), pi.second + 1));
				nextQue.push(PI(P(pi.first.first, pi.first.second + 1), pi.second + 1));
			}
		}
		while (!nextQue.empty())
		{
			que.push(nextQue.front());
			nextQue.pop();
		}
		++cnt;
	}
END:
	cout << cnt << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 6016
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)
#define _popcnt __builtin_popcount

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int N, A[100000], B[100000]; cin >> N;
  REP(i, N){
    cin >> A[i]; B[i] = A[i];
  }
  umap<int, int> mp;
  sort(B, B+N);
  REP(i, N){
    mp[B[i]] = i;
  }
  REP(i, N) A[i] = mp[A[i]];

  int ans = 0;
  REP(i, N) {
    if(A[i]%2==0 and i%2==1) ans++;
    if(A[i]%2==1 and i%2==0) ans++;
  }
  ans /= 2;
  cout << ans << endl;
}


Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std;
int main(){
    //input A B 
    // val is number between A < N<b
    // kaibun number
    // 11011,11111,11211,11311
    int A,B;
    cin >> A>> B;
    int i,j,k,l,m;
    int count=0;
    for (A;A<=B;A++){
        i = A/10000;
        j = A%10000/1000;
        k = A%10000%1000/100;
        l = A%10000%1000%100/10;
        m = A%10000%1000%100%10;
        if (i==m &&  j==l){
            count++;
        } 
    }
    cout << count << endl;
}

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

int main()
{
    int N, A, B;
    cin >> N >> A >> B;
    int answer = 0;
    for (int i = 1; i < N + 1; ++i)
    {
        int n = i;
        int j = 1;
        int compare;
        while (n != 0)
        {
            int tenpow = 1;
            for (int k = 0; k < j; ++k)
            {
                tenpow *= 10;
            }
            compare += (n % tenpow) / (tenpow / 10);
            n -= n % tenpow;
            ++j;
        }
        if (compare >= A && compare <= B)
        {
            answer += i;
        }
        compare = 0;
    }
    cout << answer << endl;
}

Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var N, K, L int
	con.Scan(&N, &K, &L)
	roads := make([]int, N)
	rails := make([]int, N)
	for i := range roads {
		roads[i] = i
		rails[i] = i
	}
	for i := 0; i < K; i++ {
		var p, q int
		con.Scan(&p, &q)
		p--
		q--
		a := roads[p]
		for a != roads[a] {
			a = roads[a]
		}
		b := roads[q]
		for b != roads[b] {
			b = roads[b]
		}
		roads[a] = roads[b]
		for p != roads[p] {
			p, roads[p] = roads[p], b
		}
		for q != roads[q] {
			q, roads[q] = roads[q], b
		}
	}
	for i := 0; i < L; i++ {
		var p, q int
		con.Scan(&p, &q)
		p--
		q--
		a := rails[p]
		for a != rails[a] {
			a = rails[a]
		}
		b := rails[q]
		for b != rails[b] {
			b = rails[b]
		}
		rails[a] = rails[b]
		for p != rails[p] {
			p, rails[p] = rails[p], b
		}
		for q != rails[q] {
			q, rails[q] = rails[q], b
		}
	}
	cmap := map[struct{ a, b int }]int{}
	for i := 0; i < N; i++ {
		for roads[i] != roads[roads[i]] {
			roads[i] = roads[roads[i]]
		}
		for rails[i] != rails[rails[i]] {
			rails[i] = rails[rails[i]]
		}
		cmap[struct{ a, b int }{roads[i], rails[i]}]++
	}
	a := make([]interface{}, N)
	for i := 0; i < N; i++ {
		a[i] = cmap[struct{ a, b int }{roads[i], rails[i]}]
	}
	con.Println(a...)
	return nil
}


Measured memory_bytes: 24448
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

string s;

inline void work(){
	cin >> s;
	if (s.size() % 2){
		puts("No");
		exit(0);
	}
	REP(i, 0, s.size() - 1)
		if (i % 2 && s[i] != 'i' || i % 2 == 0 && s[i] != 'h'){
			puts("No");
			exit(0);
		}
	puts("Yes");
}

int main(){
	work();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

#define MAX 50

signed main() {
    int n;
    cin >> n;
    ll a[n];
    rep(i, n) {
        cin >> a[i];
    }
    ll x = 0;
    for (int i = 2; i < n; i++) {
        x ^= a[i];
    }
    int d[MAX + 1];
    fill(d, d + MAX + 1, -1);
    ll sum = a[0] + a[1];
    for (int i = 0; i <= MAX; i++) {
        if (x & 1LL << i) {
            sum -= 1LL << i;
            d[i] = 0;
        }
    }
    ll c = 0;
    for (int i = MAX; i >= 0; i--) {
        if (!(x & 1LL << i) && sum >= 1LL << (i + 1)) {
            sum -= 1LL << (i + 1);
            c += 1LL << i;
            d[i] = 1;
        }
    }
    if (sum != 0) {
        cout << -1 << endl;
        return 0;
    }
    ll t = c;
    ll r = a[0] - c;
    for (int i = MAX; i >= 0; i--) {
        if (d[i] == 0 && r >= 1LL << i) {
            t += 1LL << i;
            r -= 1LL << i;
        }
    }
    ll ans = a[0] - t;
    cout << (0 <= ans && ans < a[0] ? ans : -1) << endl;
    return 0;
}

Measured memory_bytes: 3592
N, K = map(int, input().split())
V = list(map(int, input().split()))

def chmax(a,b):
    if a < b:
        a = b
    return a

Max = 0

for i in range(K+1):
    if i > N:
        break

    for j in range(K+1-i):
        if i+j > min(N,K):
            break
        list = V[0:i]
        list.extend(V[N-j:N])

        for k in range(K-i-j):

            if len(list) == 0:
                break

            if min(list) < 0:
                list.pop(list.index(min(list)))
            else:
                break

        Max = chmax(Max,sum(list))

print(Max)

Measured memory_bytes: 41964
//THIS IS THE AATMANIRBHAR SOLUTION I FOUND..!!!!!
#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';
#define pb              push_back
#include<bits/stdc++.h>
using namespace std ;
#define int long long
// #define int double
// #define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define P push
#define vvi vector<vector<int>>
#define vi vector<int>
#define vf vector<float>
#define vc vector<char>
#define vs vector<string>
#define pii vector<pair<int, int>>
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define sort(v) sort(all(v))
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(j,a,b) for(int j=a-1;j>=b;j--)
#define binod ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
const int N = 1e9 + 7, N1 = 1e7 + 5, N2 = 1e6 + 3, N3 = 1e5 + 3;
#define IX INT_MAX
#define IM INT_MIN


void solve()
{
    int n;
    cin>>n;
    int cnt=0;
    vi ans(n+5,0);
    for(int i=1; i<sqrt(n); i++)
    {
        //see(i)
        for(int j=i; j<n; j++)
        {
            if(i==j and i*i<n)
                cnt++;
            else if(i*j<n)
                cnt+=2;
            else
                break;
        }
        //see(cnt)
    }
    cout<<cnt;
}


signed main()
{
    binod;
    int t1=1;
    //cin>>t1;
    // cout<<fixed<<setprecision(9);
    while(t1--)
    {
        solve();
        cout<<endl;
    }
}

//Don't judge me or anyone
//this is life,
//not a reality show



Measured memory_bytes: 11092
N,M = map(int,input().split())
XYZ = [[int(i) for i in input().split()] for _ in range(N)]

XYZ_sum = [[0]*(2**3) for _ in range(N)]
for i in range(N):
    for j in range(2**3):
        for k in range(3):
            if (j>>k)%2 == 1:
                XYZ_sum[i][j] += XYZ[i][k]
            else:
                XYZ_sum[i][j] -= XYZ[i][k]
ans = 0
for j in range(2**3):
    ans_tmp = sum(sorted([i[j] for i in XYZ_sum],reverse=True)[:M])
    ans = max(ans,ans_tmp)
print(ans)


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

vector<int> G[100000];
bool vis[100000];
int p[100000];
int id[100000];

void dfs(int v, set<int>& idx, set<int>& ps){
	vis[v] = 1;
	idx.insert(v);
	ps.insert(p[v]);
	for(auto c : G[v]){
		if(!vis[c]) dfs(c, idx, ps);
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N, M;
	cin >> N >> M;
	for(int i = 0; i < N; i++){
		cin >> p[i];
		p[i]--;
	}
	for(int i = 0; i < M; i++){
		int x, y;
		cin >> x >> y;
		x--, y--;
		G[x].push_back(y);
		G[y].push_back(x);
	}

	int ans = 0;
	for(int i = 0; i < N; i++){
		if(vis[i]) continue;
		set<int> idx, ps;
		dfs(i, idx, ps);
		for(auto k : idx){
			if(ps.count(k)) ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 19584
#include <iostream>
using namespace std;
int main() {
	int n; cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i += 2) {
		int divesors = 0;
		for (int j = 1; j <= n; j++) {
			if (i % j == 0)
				divesors++;
		}
		if (divesors == 8)
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256