akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <cctype>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) {
            res = res * x % mod;
        }
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main () {
    
    string s; cin >>s;
    int n = s.length();

    vector<vector<int> > dp(n+1, vector<int>(13, 0));
    dp[0][0] = 1;

    reverse(s.begin(), s.end());

    for (int i = 0; i < n; i++) {
        char c = s[i];
        if (c != '?') {
            for (int k = 0; k < 13; k++) {
                int s = (ctoi(c) * mod_pow(10, i, 13)) + k;
                s %= 13;
                dp[i+1][s] += dp[i][k];
            }
        } else {
            for (int num = 0; num < 10; num++) {
                for (int k = 0; k < 13; k++) {
                    int s = (num * mod_pow(10, i, 13)) + k;
                    s %= 13;
                    dp[i+1][s] += dp[i][k];
                    dp[i+1][s] %= MOD;
                }
            }
        } 
    }

    cout << dp[n][5] << endl;

    return 0;
}



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

int factorial(int x);

int main() {
    int n, tempP = 0, tempQ = 0, ans;
    cin >> n;
    vector<int> p(n), q(n);
    rep(i, n) cin >> p.at(i);
    rep(i, n) cin >> q.at(i);
    rep(i, n) {
        tempP += factorial(n - i - 1) * (p.at(i) - 1);
        tempQ += factorial(n - i - 1) * (q.at(i) - 1);
        rep(j, n) {
            if(p.at(i) < p.at(j)) p.at(j)--;
            if(q.at(i) < q.at(j)) q.at(j)--;
        }
    }
    ans = tempP - tempQ;
    if(ans < 0) ans *= -1;
    cout << ans << endl;
}

int factorial(int x) {
    if(x == 0 || x == 1) return 1;
    return x * factorial(x - 1);
}

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

int main() {
  int N; cin >> N;
  
  int X;
  bool flag = false;
  rep(i,N+1) {
    if (floor(i*1.08) == N) {
      X = i;
      flag = true;
    }
  }
  if (flag) cout << X << endl;
  else cout << ":(" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

#define AMAX 1000000

using namespace std;

int main() {
  int N;
  cin >> N;
  vector <unsigned int> A(N);
  vector <bool> dp(AMAX + 1, true);
  
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  
  for (int i = 0; i < N; ++i) {
    if (!dp[A[i]]) continue;
    for (int j = 2; j * A[i] <= AMAX; ++j) {
      dp[j * A[i]] = false;
    }
    if (A[i] == A[i + 1]) dp[A[i]] = false;
  }
  
  int count = 0;
  for (int i = 0; i < N; ++i) {
    if (dp[A[i]]) count++;
  }
  
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long N , a;
	cin >> N;

	a = N;
	if (N >= 100)
	{
		a %= 100;
	}
	if (N >= 10)
	{
		a %= 10;
	}

	if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9)
	{
		cout << "hon" << endl;
	}
	else if (a == 0 || a == 1 || a == 6 || a == 8)
	{
		cout << "pon" << endl;
	}
	else if (a == 3)
	{
		cout << "bon" << endl;
	}
}

Measured memory_bytes: 3636
import itertools
import math

N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
n=0
A_list=itertools.permutations(range(1,N+1))
for A in A_list:
  n+=1
  A=list(A)
  if A==P:
    a=n
  if A==Q:
    b=n

print(abs(a-b))



Measured memory_bytes: 9124
import numpy as np

N = int(input())
A = [int(x) for x in input().split(" ")]
Amax = max(A)
dp = np.ones(Amax, dtype=bool)
appear = np.zeros(Amax, dtype=int)
for a in A:
  appear[a-1] += 1

for i in range(1, (len(dp) + 1) // 2):
  if not dp[i-1]:
    continue
  if appear[i-1] != 0:
    j = 2
    while j * i <= Amax:
      dp[j * i - 1] = False
      j += 1

count = 0
for a in A:
  if appear[a-1] > 1:
    continue
  else:
    count += dp[a-1]
print(count)


Measured memory_bytes: 51316
#include "bits/stdc++.h"
using namespace std;
int ans[100][100];
set<int> g[10000];
bool f[10000];
int main()
{
	int n;
	fill(ans[0],ans[100],-1);
	fill(f,f+10000,false);
	cin>>n;
	for(int i=0;i<2*n*n-2*n;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		g[a].insert(b);
		g[b].insert(a);
	}
	//左上の頂点を探す
	for(int i=0;i<n*n;i++)
	{
		if(g[i].size()==2)
		{
			ans[0][0]=i;
			f[i]=true;
			break;
		}
	}
	//1行目
	for(int j=1;j<n;j++)
	{
		for(int k=0;k<n*n;k++)
		{
			if(f[k])
				continue;
			if(j==n-1)
			{
				if(g[k].size()==2 && g[k].count(ans[0][j-1])==1)
				{
					ans[0][j]=k;
					f[k]=true;
					break;
				}
			}else{
				if(g[k].size()==3 && g[k].count(ans[0][j-1])==1)
				{
					ans[0][j]=k;
					f[k]=true;
					break;
				}
			}
		}
	}
	//2行目～n-1行目
	for(int i=1;i<n-1;i++)
	{
		for(int j=0;j<n;j++)
		{
			for(int k=0;k<n*n;k++)
			{
				if(f[k])
					continue;
				if(j==0)
				{
					if(g[k].size()==3 && g[k].count(ans[i-1][j])==1)
					{
						ans[i][j]=k;
						f[k]=true;
						break;
					}
				}else if(j==n-1){
					if(g[k].size()==3 && g[k].count(ans[i-1][j])==1 && g[k].count(ans[i][j-1])==1)
					{
						ans[i][j]=k;
						f[k]=true;
						break;
					}
				}else{
					if(g[k].size()==4 && g[k].count(ans[i][j-1])==1 && g[k].count(ans[i-1][j])==1)
					{
						ans[i][j]=k;
						f[k]=true;
						break;
					}
				}
			}
		}
	}
	//n行目
	for(int j=0;j<n;j++)
	{
		for(int k=0;k<n*n;k++)
		{
			if(f[k])
				continue;
			if(j==0)
			{
				if(g[k].size()==2 && g[k].count(ans[n-2][j])==1)
				{
					ans[n-1][j]=k;
					f[k]=true;
					break;
				}
			}else if(j==n-1){
				if(g[k].size()==2 && g[k].count(ans[n-1][j-1])==1 && g[k].count(ans[n-2][j]))
				{
					ans[n-1][j]=k;
					f[k]=true;
					break;
				}
			}else{
				if(g[k].size()==3 && g[k].count(ans[n-1][j-1])==1 && g[k].count(ans[n-2][j]))
				{
					ans[n-1][j]=k;
					f[k]=true;
					break;
				}
			}
		}
	}
	//output
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cout<<ans[i][j]+1;
			if(j<n-1)
				cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 5468
# coding=utf-8

Q = int(input())

S = set()

for i in range(Q):
    qtype, number = map(int, input().split())
    if qtype == 0:
        S.add(number)
        print(len(S))
    if qtype == 1:
        if number in S:
            print(1)
        else:
            print(0)



Measured memory_bytes: 23356
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
  double a,b,c,d,e,f;
  double x, y;
  while(cin >> a >> b >> c >> d >> e >> f) {
    x = (c*e-b*f)/(a*e-b*d) + 0;
    y = (a*f-c*d)/(a*e-b*d) + 0;
    cout << fixed << setprecision(3) << x << " " <<  y << endl;
  }
}

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

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define ll      long long

int x[202020];
int l[202020][20], r[202020][20];
int dpl[1 << 20], dpr[1 << 20];

void solve() {
        int n, v;
        cin >> n >> v;
        for (int i = 0; i < n; i ++) cin >> x[i];
        int p;
        for (int i = 0; ; i ++) if ((1 << i) > v) {
                p = i + 1;
                break;
        }
        for (int i = 0; i < n; i ++) {
                int vv = v;
                for (int j = 0; j < p; j ++) {
                        if (i == 0 || x[i] - x[i - 1] > vv) l[i][j] = i;
                        else l[i][j] = l[i - 1][j];
                        vv /= 2;
                }    
        }
        for (int i = n - 1; i >= 0; i --) {
                int vv = v;
                for (int j = 0; j < p; j ++) {
                        if (i == n - 1 || x[i + 1] - x[i] > vv) r[i][j] = i;
                        else r[i][j] = r[i + 1][j];
                        vv /= 2;
                }
        }
        for (int i = 0; i < (1 << p); i ++) {
                if (i & 1) continue;
                for (int j = 1; j < p; j ++) {
                        if ((i >> j) & 1) continue;
                        if (dpr[i] == n) dpr[i | (1 << j)] = n;
                        else dpr[i | (1 << j)] = max(dpr[i | (1 << j)], r[dpr[i]][j] + 1);
                }
        }
        for (int i = 0; i < (1 << p); i ++) dpl[i] = n - 1;
        for (int i = 0; i < (1 << p); i ++) {
                if (i & 1) continue;
                for (int j = 1; j < p; j ++) {
                        if ((i >> j) & 1) continue;
                        if (dpl[i] == -1) dpl[i | (1 << j)] = -1;
                        else dpl[i | (1 << j)] = min(dpl[i | (1 << j)], l[dpl[i]][j] - 1);
                }
        }
        bool ok = false;
        for (int i = 0; i < n; i ++) {
                if (l[i][0] == i) {
                        int c = 0;
                        for (int j = 0; j < (1 << p); j ++) {
                                c ++;
                                if (j & 1) continue;
                                if (i > 0 && dpr[j] < i) continue;
                                if (r[i][0] < n - 1 && dpl[(1 << p) - 2 - j] > r[i][0]) continue;
                                break;
                        }
                        if (c < (1 << p)) ok = true;
                        else ok = false;
                }
                if (ok) cout << "Possible" << endl;
                else cout << "Impossible" << endl;
        }
        return;
}

int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        solve();
        return 0;
}



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


def solve(N: int):
    ans = N // 2 + N % 2
    print(ans)

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
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n,m = map(int,input().split())
n = min(n,m)
x = sorted(map(int,input().split()))
dx = [0] * (m-1)

for i in range(m-1):
    dx[i] = x[i+1] - x[i]
    
dx = sorted(dx)[::-1]
    
print(x[-1] - x[0] - sum(dx[:n-1]))

Measured memory_bytes: 13960
from heapq import heappush, heappop

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

q = []
x = y = z = 0
heappush(q, (-(A[x] + B[y] + C[z]), (x, y, z)))
done = set((0, 0, 0))
ans = []
for _ in range(K):
    val, (x, y, z) = heappop(q)
    ans.append(-val)
    for i, j, k in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]:
        nx = x + i; ny = y + j; nz = z + k
        if nx < X and ny < Y and nz < Z and (nx, ny, nz) not in done:
            heappush(q, (-(A[nx] + B[ny] + C[nz]), (nx, ny, nz)))
            done.add((nx, ny, nz))

print(*ans, sep='\n')


Measured memory_bytes: 56792
import java.util.*;

// String
public class Main {
	public static void main(String[] args) {
		new Main().AOJ0020();
	}
	
	Scanner sc = new Scanner(System.in);
	void AOJ0020(){
		while(sc.hasNext())	System.out.println(sc.nextLine().toUpperCase());
	}
	
}

Measured memory_bytes: 12000
// #include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
const int MOD = 1e9 + 7; // 10^9 + 7
const ll inf = 1e10;
using namespace std;

// ------------------ コンビネーション関数 ------------------ //
// ---------------- 使用前「COMinit();」必須 ---------------- //
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// ------------------ 最大公約数関数 ------------------ //
int GCD(int x, int y) {
	if (x == 0) return y;
	else GCD(y % x, x);
}

// ------------------ ベクター表示 ------------------ //
void printVec(vector<ll>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<ll> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}


// ------------------------------------------------ //
// ------------------ ここから下 ------------------ //
// ------------------------------------------------ //

int main(void) {

	ll X,i,ans=0;
	cin >> X;
	for (i = 100; i < X; i=i+floor(i*0.01)) {
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int isLeap(int y){
	if(!(y%4) && ((y%100)||!(y%400))){
		return 1;
	}
	return 0;
}
int numMonth(int y,int m){
	int sum=0;
	int i;
	for(i=1;i<m;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)sum+=31;
		else if(i==4||i==6||i==9||i==11)sum+=30;
		else if(i==2)sum+=28;
		if(i==2&&isLeap(y))sum++;

	}
	return sum;

}
int difYear(int y1,int y2){
	int i;
	int sum=0;
	for(i=y1;i<y2;i++){
		if(isLeap(i))sum+=366;
		else sum+=365;
	}
	return sum;
}
int main(){
	int y1,y2,m1,m2,d1,d2;
	int sum=0;
	for(;scanf("%d %d %d %d %d %d",&y1,&m1,&d1,&y2,&m2,&d2)&&(y1+1&&m1+1&&d1+1&&y2+1&&m2+1&&d2+1);sum=0){
		if(y1!=y2){
			sum+=difYear(y1,y2);
		}
		sum-=numMonth(y1,m1);
		sum+=numMonth(y2,m2);
		sum-=d1;
		sum+=d2;
		printf("%d\n",sum);

	}


	return 0;
}

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

const int p = 1000000007;

int n, k;
int a[200005];

int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
    std::cin >> n >> k;
    for (int i = 1; i <= n; ++i) std::cin >> a[i];
    std::sort(a + 1, a + n + 1, [](int a, int b) { return std::abs(a) > std::abs(b); });
    int cnt = 0;
    for (int i = 1; i <= k; ++i) if (a[i] < 0) ++cnt;
    int ans = 1;
    if (!(cnt & 1)) for (int i = 1; i <= k; ++i) ans = (long long)ans * (a[i] + p) % p;
    else {
        a[0] = 1;
        int x1 = 0, x2 = 0;
        for (int i = k; i; --i) if (a[i] > 0) { x1 = i; break; }
        for (int i = k; i; --i) if (a[i] < 0) { x2 = i; break; }
        int y1 = 0, y2 = 0;
        for (int i = k + 1; i <= n; ++i) if (a[i] > 0) { y1 = i; break; }
        for (int i = k + 1; i <= n; ++i) if (a[i] < 0) { y2 = i; break; }
        for (int i = 1; i <= k; ++i) if (i != x1 && i != x2) ans = (long long)ans * (a[i] + p) % p;
        if ((!x1 || !y2) && (!x2 || !y1)) {
            ans = 1;
            for (int i = n; i > n - k; --i) ans = (long long)ans * (a[i] + p) % p;
        }
        else if (!x1 || !y2 || (long long)a[x1] * a[y1] > (long long)a[x2] * a[y2]) ans = (long long)ans * a[x1] % p * a[y1] % p;
        else ans = (long long)ans * (a[x2] + p) % p * (a[y2] + p) % p;
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 4408
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
using namespace std;

const long long MOD = 1000000007;

long long power(long long m, long long n){
    long long res = 1;
    while(n > 0){
        if(n & 1) {
            res = (res * m) % MOD;
        }
        m = (m * m) % MOD;
        n >>= 1;
    }
    return res;
}

long long prev_counts[100000];
int main(){
  int N;
  int K;
  cin >> N >> K;

  long long ans = 0;
  for(int i = K; i >= 1; i--){
    long long cases = (power(K / i, N) - prev_counts[i] + MOD) % MOD;
    ans = (ans + ((long long) i * cases) % MOD) % MOD;

    set <int> divisors;
    for(int j = 1; j < sqrt(i) + 1; j++){
      if(i % j == 0){
        divisors.insert(j);
        divisors.insert(i / j);
      }
    }
    for(auto it = divisors.begin(); it != divisors.end(); it++){
      prev_counts[*it] = (prev_counts[*it] + cases) % MOD;
    }
  }
  cout << ans << endl;
  return 0;
}


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

s = input()
print(chr(ord(s)+1))

Measured memory_bytes: 63468
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n;

int main(){
	cin>>n;
	ll res=0;
	for(ll i=2;i*i<=n;i++) if(n%i==0){
		ll t=0;
		while(n%i==0) n/=i,t++;
		ll j=1;
		while(j<=t){
			t-=j;
			res++;
			j++;
		}
	}
	if(n>1) res++;
	cout<<res<<endl;
}

Measured memory_bytes: 3616
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, a: [usize; n], b: [usize; n]);

    if let Some(ans) = solve(n, &a, &b) {
        println!("Yes");
        for a in ans {
            println!("{}", a)
        }
    } else {
        println!("No")
    }
}

fn solve(n: usize, a: &[usize], b: &[usize]) -> Option<Vec<usize>> {
    let mut d = 0;
    let b = [b; 2].concat();
    for i in 0..n {
        while i + d < n && a[i] >= b[i + d] {
            d += 1;
        }
        if a[i] == b[i + d] {
            return None;
        }
    }
    Some((&b[d..d + n]).into())
}


Measured memory_bytes: 12548
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string s,t; cin >> s >>t ;
    int res=INF;
    rep(i,s.size()-t.size()+1){
        int tmpe=0;
        string tmp=s.substr(i,t.size());
        rep(j,t.size()){
            if(tmp[j]!=t[j]) tmpe++;
        }
        chmin(res,tmpe);
    }
    cout<<res<<endl;
}

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

 using namespace std;

 int main() {
   string SA, SB, SC;
   char turn;
   bool finished;

   cin >> SA >> SB >> SC;

   turn = 'a';
   finished = false;

   while (!finished) {
     if (turn == 'a') {
       if (SA.empty()) {
         cout << "A" << endl;
         finished = true;
         break;
       }
       else {
         turn = SA.at(0);
         SA = SA.substr(1, SA.length() - 1);
       }
     }
     else if (turn == 'b') {
       if (SB.empty()) {
         cout << "B" << endl;
         finished = true;
         break;
       }
       else {
         turn = SB.at(0);
         SB = SB.substr(1, SB.length() - 1);
       }
     }
     else if (turn == 'c') {
       if (SC.empty()) {
         cout << "C" << endl;
         finished = true;
         break;
       }
       else {
         turn = SC.at(0);
         SC = SC.substr(1, SC.length() - 1);
       }
     }
   }
 }


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let S: Vec<char> = sc.chars();
    if S[2] == S[3] && S[4] == S[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int MAXN = 120000;

int n, m;
ll a[MAXN];
ll b[MAXN];
int en[MAXN];
int p[MAXN];
int sz[MAXN];

vector<int> eds[MAXN];

set<pair<ll, int> > ss[MAXN];
ll sum[MAXN];

int get(int x) {
	if (x == p[x])
		return x;
	return p[x] = get(p[x]);
}

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
		a[i] = max(a[i], b[i]);
	}
	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		eds[a].push_back(b);
		eds[b].push_back(a);
	}
	ll l = -1;
	ll r = 1e9;
	while (r - l > 1) {
		ll mid = (l + r) >> 1;
		fill(en, en + n, 0);
		iota(p, p + n, 0);
		for (int i = 0; i < n; ++i)
			ss[i].clear();
		for (int i = 0; i < n; ++i) {
			if (!en[i] && a[i] <= b[i] + mid) {
				en[i] = 1;
				sum[i] = mid + b[i];
				queue<int> qu;
				qu.push(i);
				while (!qu.empty()) {
					int x = qu.front();
					qu.pop();
					for (int j: eds[x])
						if (get(j) != i)
							ss[i].emplace(a[j] - b[j], j);
					while (!ss[i].empty() && ss[i].begin()->first <= sum[i]) {
						int x = ss[i].begin()->second;
						ss[i].erase(ss[i].begin());
						if (!en[x]) {
							sum[i] += b[x];
							en[x] = 1;
							p[x] = i;
							qu.push(x);
						}
						else {
							x = get(x);
							if (x == i)
								continue;
							sum[i] += sum[x] - mid;
							if (ss[x].size() > ss[i].size())
								swap(ss[x], ss[i]);
							for (auto e: ss[x])
								ss[i].insert(e);
							ss[x].clear();
							p[x] = i;
						}
					}
				}
			}
		}
		if (accumulate(en, en + n, 0) == n)
			r = mid;
		else
			l = mid;
	}
	cout << r + accumulate(b, b + n, 0ll) << "\n";
	return 0;
}




Measured memory_bytes: 18672
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=1000;

ll N;

int main(){
  cin>>N;
  if(N>=1000)cout<<"ABD"<<endl;
  else cout<<"ABC"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void call(int num) {

	for (int i = 1; i <= num; i++) {

		int x = i;

		//3????????°?????¨???
		if (x % 3 == 0) {
			cout << " " << i;
		}
		//3???????????°?????¨???
		else {
			do {

				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}

				x/= 10;

			} while (x);

		}
	}

	cout << endl;

}

int main(){

	int num;

	cin >> num;

	call(num);
	
	return 0;
}

Measured memory_bytes: 3060
def checkKaibun(str):
    for i in range(int(len(str) / 2)):
        if str[i] != str[-i - 1]:
            return False
    return True
 
s = input()
n = len(s)
c2e = int((n - 1) / 2)
c3s = int((n + 3) / 2) - 1
if not checkKaibun(s):
    print('No')
elif not checkKaibun(s[0:c2e]):
    print('No')
elif not checkKaibun(s[c3s:n]):
    print('No')
else :
    print('Yes')
 
            

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

#define LEN_MAX 80
#define LEN_MAX1 (LEN_MAX+1)
#define NMAX 20

void remove_feed(char *text);
void decode(char *input,char *output);
char shift(char in);
int check_decoded(char *text);

int main(){
   int n=0;
   char input[LEN_MAX1], output[LEN_MAX1];
   while(fgets(input,sizeof(input),stdin)!=NULL){
      if(strlen(input)<=1) break;
      remove_feed(input);
      if(n>=NMAX) break;
      decode(input,output);
      printf("%s\n",output);
      ++n;
   }
   return 0;
}

void remove_feed(char *text){
   int i;
   for(i=0;i<strlen(text);i++){
      if(text[i]=='\n'){ text[i]='\0'; break; }
   }
}

void decode(char *input,char *output){
   int i, j, k, len;
   len=strlen(input);
   for(i=0;i<26;i++){
      strcpy(output,input);
      for(j=0;j<len;j++){
         if(output[j]==' '||output[j]=='.') continue;
         for(k=0;k<i;k++) output[j]=shift(output[j]);
      }
      if(check_decoded(output)==1) break;
   }
}

char shift(char in){
   if(in=='z') return 'a';
   return (in+1);
}

#define NKEY 3
int check_decoded(char *text){
   int i, j, flag;
   char key[NKEY][5] = { "the", "this", "that" };
   char comp[10];
   for(i=0;i<NKEY;i++){
      if(strcmp(text,key[i])==0) goto decoded;
      sprintf(comp," %s ",key[i]);
      if(strstr(text,comp)!=NULL) goto decoded;
      sprintf(comp," %s.",key[i]);
      if(strstr(text,comp)!=NULL) goto decoded;
      for(j=0,flag=1;j<strlen(key[i]);j++){
         if(key[i][j]!=text[j]){ flag=0; break; }
      }
      if(flag==1&&(text[strlen(key[i])]=='.'||text[strlen(key[i])]==' ')) goto decoded;
   }
   return 0;
decoded:
   return 1;
}

Measured memory_bytes: 556
import heapq

X, Y, A, B, C = map(int, input().split()) 
pl = list(map(int, input().split())) 
ql = list(map(int, input().split())) 
rl = list(map(int, input().split())) 

pl.sort()
ql.sort()
rl.sort(reverse=True)
pl_x_larges = pl[A-X:A]
ql_y_larges = ql[B-Y:B]

pq_xy = pl_x_larges + ql_y_larges
pq_xy.sort()

for i, r in enumerate(rl):
    if r > pq_xy[i]:
        pq_xy[i] = r
    else:
        break

print(sum(pq_xy))

Measured memory_bytes: 23456
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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 Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    int N;
    cin >> N;
    int mn = INT_MAX;
    int cnt=0;
    REP(i, N){
        int A;
        cin >> A;
        if(chmin(mn, A)){
            cnt++;
        }
    }
    cout << cnt << el;
}



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

int main() {
  int l, r; cin >> l >> r;

  int ans = 2019;
  for(long long i=l; i<r && i<=l+2019; ++i){
    for(long long j=i+1; j<=r && j<=i+1+2019; ++j){
      int x = i*j % 2019;

      ans = min(x, ans);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string st,xst;
int main()
{
	cin>>st;
	for(int i=0;i<st.size();i++)
		if(st[i]=='0'||st[i]=='1')xst+=st[i];
		else if(xst.size()>0)xst.erase(xst.size()-1,1);
	cout<<xst<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;

const ll mod = 1000000007;
const int N = 2e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
ll n, m;
ll a[N];
int main() {
	while(~scanf("%lld%lld", &n, &m)) {
		rep(i, 1, n + 1) scanf("%lld", &a[i]), a[i] /= 2;
		ll lm = a[1];
		rep(i, 2, n + 1) {
			lm = lm / gcd(lm,a[i]) * a[i];
			if(lm > m) {
				lm = 2e9;
				break;
			}
		}
		bool odd = true, even = true;
		rep(i, 1, n + 1) {
			ll d = lm / a[i];
			if(d % 2 == 0) odd = false;
			else even = false;
		}
		if(odd) {}
		else if(even) lm *= 1.5;
		else lm = 2e9; 
		// de(lm);
		ll ret = m / lm;
		ret = ret / 2 + (ret % 2);
		printf("%lld\n", ret);
	}
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define MAXN 100005
#define LL long long
#define P int(1e9+7)
using namespace std;

int N,M,S,T;
struct edge{
	int v,w;
	edge(int v=0, int w=0):v(v), w(w){}
};

vector<edge> adj[MAXN];

struct Node{
	int id;
	LL v;
	Node(int id=0, LL v=0):id(id), v(v){}
	
	bool operator < (const Node& n1) const{
		return v > n1.v;
	}
};

bool vis[MAXN];
LL d1[MAXN], d2[MAXN], g1[MAXN], g2[MAXN];
void dijkstra1(){
	memset(d1, 1, sizeof(d1));
	d1[S] = 0;
	priority_queue<Node> q;
	q.push(Node(S,0));
	
	int u,v,w;
	while(!q.empty()){
		u = q.top().id; q.pop();
		if(vis[u]) continue;
		vis[u] = 1;
		
		for(int k=0;k<adj[u].size();k++){
			v = adj[u][k].v;
			w = adj[u][k].w;
			if(d1[u] + w < d1[v]){
				g1[v] = g1[u];
				d1[v] = d1[u] + w;
				q.push(Node(v, d1[v]));
			}
			else if(d1[u] + w == d1[v]){
				g1[v] = (g1[v] + g1[u]) % P;
			}
		}
	}
}

void dijkstra2(){
	memset(d2, 1, sizeof(d2));
	d2[T] = 0;
	priority_queue<Node> q;
	q.push(Node(T,0));
	
	int u,v,w;
	while(!q.empty()){
		u = q.top().id; q.pop();
		if(vis[u]) continue;
		vis[u] = 1;
		
		for(int k=0;k<adj[u].size();k++){
			v = adj[u][k].v;
			w = adj[u][k].w;
			if(d2[u] + w < d2[v]){
				g2[v] = g2[u];
				d2[v] = d2[u] + w;
				q.push(Node(v, d2[v]));
			}
			else if(d2[u] + w == d2[v]){
				g2[v] = (g2[v] + g2[u]) % P;
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(0);
	
	cin>>N>>M>>S>>T;
	int u,v,w;
	for(int i=1;i<=M;i++){
		cin>>u>>v>>w;
		adj[u].push_back(edge(v,w));
		adj[v].push_back(edge(u,w));
	}
	
	g1[S] = g2[T] = 1;
	dijkstra1();
	memset(vis, 0, sizeof(vis));
	dijkstra2();
	
	LL ans = g1[T]*g2[S]%P;
	LL D = d1[T];

	for(u=1;u<=N;u++){
		if(d1[u] + d2[u]==D && d1[u]==d2[u]){
			ans = (ans - g1[u]*g2[u]%P*g1[u]%P*g2[u]%P + P) % P;
		}
		
		for(int k=0;k<adj[u].size();k++){
			v = adj[u][k].v;
			w = adj[u][k].w;
			if(d1[u] + w + d2[v] == D){
				if(d1[u] < d2[u] && d2[v] < d1[v]){
					ans = (ans - g1[u]*g2[v]%P*g1[u]%P*g2[v]%P + P) % P;
				}
			}
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15188
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long 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 ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    int n;
    cin >> n;
    vector<int> h(n);
    REP(i,n) cin >> h[i];
    reverse(ALL(h));
    for(int i=1;i<n;i++){
        if(h[i]>h[i-1])h[i]--;
        if(h[i]>h[i-1]){
            cout << "No" << endl;
            return 0;
        }

    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3760
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll dp[100001];
ll w[100], v[100];
int main() {
	int N, W;
	cin >> N >> W;
	for (int i = 0; i < N; i++) cin >> w[i] >> v[i];
	for (int i = 0; i < N; i++) {
		for (int j = W; j >= w[i]; j--) {
			dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
		}
	}
	ll ans = 0;
	for (int i = 0; i <= W; i++) ans = max(ans, dp[i]);
	cout << ans << endl;
}

Measured memory_bytes: 1024
a, b, c, d, e, f = map(int, input().split())
beaker = {'water':0, 'sugar':0, 'percent':0}
maxpercent=e/(100+e)
maxtimes = f // (100 + e)
maxc = e*maxtimes//c
percent = 0
for i in range(maxc + 1):
    for j in range((e*maxtimes-i*c)//d + 1):
        sugar = i*c + j*d
        minwater = sugar/maxpercent - sugar
        maxa = int((minwater + 100*a)//(100*a))
        maxb = int((minwater + 100*b)//(100*b))
        for atimes in range(maxa + 1):
            for btimes in range(maxb + 1):
                if 100 * (atimes * a + btimes * b)< minwater:
                    continue
                water = 100 * (atimes * a + btimes * b)
                if water + sugar == 0 or water + sugar > f:
                    continue
                percent = 100 * sugar/(water + sugar)
                if beaker['percent'] <= percent:
                    beaker['water']=water
                    beaker['sugar']=sugar
                    beaker['percent']=percent
print(str(beaker['water']+beaker['sugar']) + ' ' + str(beaker['sugar']))


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
#include<bitset>
typedef long long ll;
using namespace std;
int main() {
	ll a[2];
	for (ll i = 0; i < 3; ++i) {
		cin >> a[i];
	}
	sort(a, a + 3);
	if ((a[0] * a[1] * a[2]) % 2 == 0)
		cout << 0 << endl;
	else
		cout << a[0] * a[1] << endl;
}

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

#define N 2005
int m, n;
char s[N], t[N];
char c[2]={'I', 'O'};

int memo[N][N][2];
int DP(int, int, int);
inline int dp(int p, int q, int r){
	if(~memo[p][q][r]) return memo[p][q][r];
	else return memo[p][q][r]=DP(p, q, r);
}
int DP(int p, int q, int r){
	int ret = 0;
	if(p<m && s[p]==c[r]) ret=max(ret, dp(p+1, q, 1-r)+1);
	if(q<n && t[q]==c[r]) ret=max(ret, dp(p, q+1, 1-r)+1);
	// printf("dp(%d, %d, %d)=%d\n", p, q, r, ret);
	return ret;
}

int main(){
	scanf("%d%d", &m, &n);
	scanf("%s%s", s, t);
	int ans = 0;
	REP(i, N) REP(j, N) memo[i][j][0]=memo[i][j][1]=-1;
	REP(i, m){
		REP(j, n){
			int d = dp(i, j, 0);
			if(ans<d) ans=d;
		}
	}
	ans=(ans+1)/2*2-1;
	if(ans<0) ans=0;
	printf("%d\n", ans);
}

Measured memory_bytes: 34780
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ll long long
#define MOD 1000000007
#define ull unsigned long long int
#define db double
#define fi first
#define se second
#define pb push_back
#define vec vector<ll>
#define pr pair<ll,ll>
#define pq priority_queue<ll,vector<ll>, compare_queue >
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define GS(s)   string s; getline(cin,s);
#define lll __int128_t
#define endl "\n"
#define Next cout.flush()

struct compare_queue
{
    bool operator()(const pair<ll,pr>& a, const pair<ll,pr>& b)
    {
        return a.fi < b.fi;
    }
};

ll gcd(ll u,ll v)
{
	if(v==0)
	return u;
	
	else
	return gcd(v,u%v);
}

// ll power(ll x,ll y) 
// { 
//     if (y == 0) 
//         return 1; 
//     ll p = power(x, y/2)%MOD; 
//     p = ((p%MOD) * (p%MOD))%MOD; 

//     return (y%2 == 0)? p%MOD : ((x%MOD) * (p%MOD))%MOD; 
// } 

// ll modInverse(int a) 
// { 
//     if(a==1){return 1;}
//     return power(a,MOD-2); 
// } 
  
// // // #define MAX 1000000
// int primes[1000009],cnt=0;
// int spf[1000009];
// // vector<int> factors[1000009];
// char str[1000009];
// void pre()
// {
//     spf[1]=1;
//     spf[0]=1;
//     // calcualting primes
//     int n=1000000;
//     for(int i=2; i*i<=n; i++){
//         if(str[i]==0){
//                 spf[i]=i;
//                 for(int j=i; j*i<=n; j++){
//                     if(spf[i*j]==-1){spf[i*j]=i;}
//                     str[i*j]=1;
//                 }
                
//         }
//     }  

// }


// // A O(log n) function returning primefactorization 
// // by dividing by smallest prime factor at every step 
// int getF(ll x) 
// { if(x==1){return 1;}
//     int ret=0; 
//     while (x != 1) 
//     { 
//         ret++; 
//         x = x / spf[x]; 
//     } 
//     return ret; 
// } 

// C:\Users\A\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\lambda


void Function(){
ll n;
cin >> n;
ll i,ans=0,j;
vec dp(n+1,0);
for(i=1;i<=n;i++){
    for(j=i;j<=n;j=j+i){
        dp[j]++;
    }
}

for(i=1;i<=n-1;i++){
    ans+=dp[n-i];
}

cout << ans << endl;

}


int main(){ 
fast;
ll t=1,i=0,j=0,k,h;
// memset(spf,-1,sizeof(spf));
// pre();
// cin >> t;
for(h=1;h<=t;h++){

Function();

}


return 0;

}

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

int main(){
    long long N,Q;
    string S;
    vector<long long> s{0};
    cin>>N>>Q;
    cin>>S;
    for (unsigned long i=0;i<S.size();i++){
        long long count=0;        
        if(i>0 and S[i]=='C' and S[i-1]=='A')count++;
        s.push_back(s[i]+count);
    }
    for(int j=0;j<Q;j++) {
        long long l,r;
        cin>>l>>r;
        cout<<s[r]-s[l]<<endl;
    }
}

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

int main(){
  int n, m;
  string s,t;

  set<string> st;
  cin >> n;
  for( int i=0;i<n;i++ ){
    cin >> s;
    st.insert(s);
  }
  cin >> m;
  bool is_open=false;
  for( int i=0;i<m;i++ ){
    cin >> t;
    if( st.find(t) == st.end() ){
      cout << "Unknown " << t << endl;
    }else{
      is_open = !is_open;
      if( is_open )
	cout << "Opened by " << t << endl;
      else
	cout << "Closed by " << t << endl;
    }
  }


  return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int N,D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));

    for(int i = 0; i < N; ++i) for(int j = 0; j < D; ++j) cin >> X[i][j];

    int cnt = 0;
    for(int i = 0; i < N - 1; ++i){
        for(int k = i+1; k < N; ++k){
            int distance = 0;
            for(int j = 0; j < D; ++j){
                distance += pow(X[i][j] - X[k][j], 2);
            }
            int a = static_cast<int>(sqrt(distance));
            if(distance == a * a) cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
n, a, b = map(int, input().split())
s = list(input())
p = 0
ab = 0
for i in s:
  if i == "c":
    print("No")
  elif i == "a":
    if p < a + b:
      p += 1
      print("Yes")
    else:
      print("No")
  else:
    if p < a + b and ab < b:
      p += 1
      ab += 1
      print("Yes")
    else:
      print("No")


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

int main(){
	int ans=0;
	int temp=0;
	bool before_s=false;
	string s;
	cin>>s;

	rep(i,3){
		if(before_s==false&&s[i]=='R'){
			temp=1;
		}
		else if(before_s==true&&s[i]=='R'){
			temp++;
		}
		if(ans<temp){
			ans=temp;
		}

		if(s[i]=='R'){
			before_s=true;
		}
		else if(s[i]=='S'){
			before_s=false;
		}
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
char buf[1<<20],*p1,*p2;
#define GC (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?0:*p1++)
template<class T> inline void read(T &n){
	char ch=GC;T w=1,x=0;
	while(!isdigit(ch)){if(ch=='-') w=-1;ch=GC;}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=GC;}
	n=x*w;
}
const int maxn=10005;
int n,A[maxn],B[maxn];
void check(int p){
	if(A[0]%p) return;
	for(int i=0;i<=n;i++) B[i]=A[i];
	for(int i=n;i>=p-1;i--){
		(B[i-(p-1)]+=B[i])%=p;
		B[i]=0;
	}
	for(int i=0;i<=n;i++) if(B[i]%p) return;
	printf("%d\n",p);
}
void solve(int x){
	for(int i=2;i*i<=x;i++){
		if(x%i) continue;
		if(i>n) printf("%d\n",i);
		while(x%i==0) x/=i;
	}
	if(x>max(n,1)) printf("%d\n",x);
}
int isp[maxn],pri[maxn],tot;
void seive(int N){
	for(int i=2;i<=N;i++){
		if(!isp[i]){
			pri[++tot]=i;
			check(i);
		}
		for(int j=1;j<=tot&&i*pri[j]<=N;j++){
			isp[i*pri[j]]=1;
			if(i%pri[j]==0) break;
		}
	}
}
inline int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
int main(){
//	freopen("poly.in","r",stdin);
//	freopen("poly.out","w",stdout);
	read(n);
	int G=0;
	for(int i=n;i>=0;i--)
		read(A[i]),G=gcd(abs(A[i]),G);
	seive(n),solve(G);
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

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

int main(){
  int x,y;
  cin >> x >> y;
  int ans = 0;
  if(x==1) ans += 300000;
  else if(x==2) ans += 200000;
  else if(x==3) ans += 100000;

  if(y==1) ans += 300000;
  else if(y==2) ans += 200000;
  else if(y==3) ans += 100000;

  if(x==1 && y==1) ans += 400000;
  cout<< ans <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	string a,b,c;
	cin>>a>>b>>c;
	cout<<a[0]<<b[0]<<c[0]<<endl;
}










Measured memory_bytes: 256