akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

map<ll, ll> primeFactor(ll n) {
  map<ll, ll> res;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}

int main() {
  ll a, b;
  cin >> a >> b;
  ll gcd = __gcd(a, b);
  auto mp = primeFactor(gcd);
  cout << mp.size() + 1 << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] ss = S.toCharArray();
        int len = ss.length;
        for (int i = 0; i < len; i++){
            System.out.print("x");
        }
    }
}


Measured memory_bytes: 23764
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        long d = sc.nextLong();
        int ans = 0;		
        for(int i=0;i<n;i++){long x = sc.nextLong();
                             long y = sc.nextLong();
                             if(x*x+y*y<=d*d){ans++;}                            
                            }
		System.out.println(ans);
	}
}

Measured memory_bytes: 59204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif
#define MOD 1'000'000'007

#define N 112345
int n;
char s[N];
int a[2][N]={};
ll pw2[N], pw3[N];

int main(){
	pw2[0]=pw3[0]=1;
	FOR(i, 1, N) pw2[i]=pw2[i-1]*2%MOD;
	FOR(i, 1, N) pw3[i]=pw3[i-1]*3%MOD;
	scanf("%s", s); n = strlen(s);
	REP(i, n) a[s[i]-'0'][i+1]=1;
	REP(j, 2) REP(i, n) a[j][i+1]+=a[j][i];
	ll ans = pw2[a[1][n]];
	REP(i, n){
		if(s[i] == '1'){
			ll tmp = pw2[a[1][i]] * pw3[n-i-1] % MOD;
			ans += tmp; ans %= MOD;
		}
	}

	// ll ans = pw3[n-1];
	// ans += pw2[a[0][n]+1]; ans%=MOD;
	// // bool fst = true;
	// FOR(i, 1, n){
	// 	if(s[i]=='1'){
	// 		ll tmp = 2;
	// 		// if(fst) fst=false, tmp=2;
	// 		tmp%=MOD; tmp *= pw2[a[0][i]+1];
	// 		tmp%=MOD; tmp *= pw3[n-i-1];
	// 		DEBUG("a[0][i]=%d i=%d tmp=%lld\n", a[0][i], i, tmp);
	// 		ans+=tmp; ans%=MOD;
	// 	}
	// }
	printf("%lld\n", ans);
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n1,n2) for(int (i)=(int)(n1);(i)<(int)(n2);++(i))
#define lpr(i,n1,n2) for(int (i) =(int)(n1); (i) >= (int)(n2);--(i))
#define scan(a) scanf("%d",&a)
#define scan2(a,b) scanf("%d %d",&a,&b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define PI 3.14159265
#define F first
#define S second
typedef map<int,int> mii;
typedef map<string,string> mss;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;

    ll A[1000001];
    int main()
    {
        ll n;
        cin>>n;
        lp(i,0,n)
            cin>>A[i];
        sort(A,A+n);
        ll ans = 0;
        ll cont = A[0];
        lp(i,1,n)
        {
            if( A[i] > 2*cont)
            {
                ans = i;
            }
            cont = cont +A[i];
        }
        printf("%lld",n-ans);

        return 0;
    }



Measured memory_bytes: 1024
#include<stdio.h>
int a[10001],b[10001];
int main()
{
	int n,m,i,cnt,flag[501];
	
	while(1){
		
		for(i=0;i<=500;i++){
			flag[i]=0;
			cnt=0;
		}
		scanf("%d %d",&n,&m);
		if(n == 0 && m == 0)
			break;

		for(i = 0; i < m; i++){
			scanf("%d %d",&a[i],&b[i]);

			if(a[i] ==1)
				flag[b[i]] = 1;
		}

		for(i = 0; i < m; i++){
			if(flag[a[i]] == 1 && flag[b[i]] == 0){
				flag[b[i]] = 2;
			}
			if(flag[a[i]] == 0 && flag[b[i]] == 1){
				flag[a[i]] = 2;
			}
		}

		for(i = 2; i <= 500; i++){
			if(flag[i])cnt++;
		}

		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    string s;cin>>s;
    ll a=0,b=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='0') a++;
        else b++;
    }
    cout<<min(a,b)*2<<endl;
}


Measured memory_bytes: 512
import java.util.*;

class Main {
  public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
    if((a > 0) && (a < 10) && (b > 0) && (b < 10)) {
      System.out.println(a * b);
    } else {
      System.out.println(-1);
    } 
  }
}


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

using namespace std;

int main(){
    vector<int> A(9);
    copy_n(istream_iterator<int>(cin), 9, A.begin());
    int n;
    cin >> n;
    vector<bool> C(9);
    for (int i = 0; i < n; i++){
        int b;
        cin >> b;
        for (int i = 0; i < 9; i++){
            C[i] = C[i] or (A[i] == b); 
        }
    }

    int64_t ans = false;
    ans |= (C[0] and C[1] and C[2]) or (C[3] and C[4] and C[5]) or (C[6] and C[7] and C[8]);
    ans |= (C[0] and C[3] and C[6]) or (C[1] and C[4] and C[7]) or (C[2] and C[5] and C[8]);
    ans |= (C[0] and C[4] and C[8]) or (C[2] and C[4] and C[6]);

    puts(ans ? "Yes" : "No");
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n,i;
    long int sum=0;
    scanf("%d",&n);
    int a[n+1],b[n];
    for(i=0;i<n+1;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++){
        scanf("%d",&b[i]);
    }
    for(i=0;i<n;i++){
        if(a[i]>b[i]){
            sum+=b[i];
        }else{
            sum+=a[i];
            b[i]-=a[i];
            if(b[i]>=a[i+1]){
                sum+=a[i+1];
                a[i+1]=0;
            }else{
                sum+=b[i];
                a[i+1]-=b[i];
            }
        }
    }
    printf("%ld\n",sum);
    return 0;
}



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

using namespace std;

bool dp[2][20000];
vector<int> vx, vy;

bool check(int a, vector<int> &v) {
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j <= 20000; j++) {
      if (!dp[0][j]) continue;
      if (j - v[i] >= 0) dp[1][j - v[i]] |= true;
      if (j + v[i] <= 20000) dp[1][j + v[i]] |= true;
    }
    swap(dp[0], dp[1]);
    fill(dp[1], dp[1] + 20000, false);
  }
  return dp[0][a + 10000];
}

int main(void) {
  string s;
  int x, y;
  cin >> s >> x >> y;

  int sz = s.size();
  int l = 0, r = 0, turn = 0;
  while (l < sz) {
    while (r < sz && s[r] == 'F') r++;
    if (l == 0) {
      dp[0][r - l + 10000] = true;
    } else if (turn & 1) {
      vy.push_back(r - l);
    } else {
      vx.push_back(r - l);
    }
    turn++;
    l = ++r;
  }

  bool yes = check(x, vx);
  fill(dp[0], dp[1], false);
  dp[0][10000] = true;
  yes &= check(y, vy);

  cout << (yes ? "Yes" : "No") << endl;

  return 0;
}

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

int main() {
	int a,b,c; cin >> a >> b >> c;
	int now=a;
	for(int i=0;i<=b;i++) {
		if(now%b==c) {
			cout << "YES" << endl;
			return 0;
		}
		else now+=a;
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mod 1000000007
#define setpres(x) fixed<<setprecision(x)
using namespace std;
int dp[2001];
int ways(int s)
{
    if(s==0)
        return 1;
    if(dp[s]!=-1)
        return dp[s];
    int curr=0;
    for(int i=3;s-i>=0;i++)
        curr=(curr+ways(s-i))%mod;
    return dp[s]=curr;
}
int32_t main()
{
    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        int s;
        cin>>s;
        memset(dp,-1,sizeof(dp));
        cout<<ways(s);
    }
}


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

int n;
ll dp[100100];
int h[100100];

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

    dp[1] = 0;
    dp[2] = abs(h[1] - h[2]);

    for (int pos = 3; pos <= n; ++pos) {
        dp[pos] = min(
            dp[pos - 1] + abs(h[pos] - h[pos - 1]),
            dp[pos - 2] + abs(h[pos] - h[pos - 2])
        );
    }

    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=1e5+10;
vector<int>g[mx];
int color[mx];
bool bip=true;
uli cnt[2];
void dfs(int u){
  cnt[color[u]]++;
  for(int v:g[u]){
    if(color[v]==-1){
      color[v]=(color[u]^1);
      dfs(v);
    }
    else if(color[v]!=(color[u]^1)) bip=false;
  }
}
int main(){
  int n,m;
  scanf("%d %d",&n,&m);
  for(int i=0;i<m;i++){
    int u,v;
    scanf("%d %d",&u,&v);
    g[--u].push_back(--v);
    g[v].push_back(u);
  }
  memset(color,-1,sizeof color);
  color[0]=0;
  dfs(0);
  if(bip)printf("%lld\n",cnt[0]*cnt[1]-m);
  else printf("%lld\n",(uli(n)*uli(n-1))/2ll-m);
  return 0;
}


Measured memory_bytes: 6656
import java.util.Scanner;

/**
 * @author yoshizaki
 *
 */
public class Main {
    public static long inf = 1000000000000000000l;
    
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int item = scanner.nextInt();
        int maxw = scanner.nextInt();
        
        int[] weight = new int[110];
        long[] value = new long[110];
        
        for(int i = 0; i < item; i++) {
            weight[i] = scanner.nextInt();
            value[i] = scanner.nextLong();
        }
        
        long[][] dp = new long[110][100100];
        
        for(int i = 0; i < item; i++) {
            for (int sumw = 0; sumw <= maxw; sumw++) {
                if(sumw - weight[i] >= 0) {
                    dp[i+1][sumw] = chmax(dp[i+1][sumw], dp[i][sumw - weight[i]]+ value[i]);
                }
                dp[i+1][sumw] = chmax(dp[i+1][sumw], dp[i][sumw]);
            }
        }
        
        
        System.out.println(dp[item][maxw]);
    }
    public static long chmax(long a, long b) {
        if (a < b) return b;
        return a;
    }
}

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

int main(){
	int r, d, x;
	scanf("%d %d %d", &r, &d, &x);

	for (int i = 1; i <= 10; i++){
		x = r*x - d;
		printf("%d\n", x);
	}
}

Measured memory_bytes: 1684
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define pque priority_queue
typedef vector <int> vi;
typedef pair <int, int> ii;
typedef vector <ii > vii;

const int mod = 1e9 + 7, N = 2e5 + 1;

vi p;
bool npr[N];
int n;
map <int, int> a, b;

void sieve(){
	for (int i = 2; i < N; i++){
		if (!npr[i]){
			p.push_back(i);
			for (int j = i * i; j < N; j += i){
				npr[j] = 1;
			}
		}
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	sieve();
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++){
		int x, y = 1, z = 1;
		cin >> x;
		for(int j = 0; p[j] * p[j] * p[j] <= x; j++){
			if (x % p[j]){
				continue;
			}
			int exp = 0;
			while (x % p[j] == 0){
				exp = (exp + 1) % 3;
				x /= p[j];
			}
			if (!exp){
				continue;
			}
			y *= p[j];
			z *= p[j];
			if (exp < 2){
				z *= p[j];
			}
			else{
				y *= p[j];
			}
		}
		if (x > 1){
			int t = sqrt(x);
			if (t * t == x){
				z *= t;
				y *= t * t;
			}
			else{
				y *= x;
				z *= x * x;
			}
		}
		a[y]++;
		b[y] = z;
	}
	
	if (a.count(1)){
		ans = 1;
		a.erase(1);
	}
	map <int, int>::iterator it = a.begin();
	while (it != a.end()){
		int x = it -> fi, y = b[x];
		ans += max(a[x], a[y]);
		a.erase(x);
		a.erase(y);
		it = a.lower_bound(x);
	}
	cout << ans;
}

Measured memory_bytes: 13052
#include <algorithm>            // https://cpprefjp.github.io/reference/algorithm.html
#include <ios>                  // https://cpprefjp.github.io/reference/ios.html
#include <iostream>             // https://cpprefjp.github.io/reference/iostream.html
#include <map>                  // https://cpprefjp.github.io/reference/map.html
#include <set>
#include <string>               // https://cpprefjp.github.io/reference/string/basic_string/find.html
#include <vector>               // https://cpprefjp.github.io/reference/vector/vector.html
#include <utility>              // https://cpprefjp.github.io/reference/utility.html

#include <climits>
#include <cmath>                // https://cpprefjp.github.io/reference/cmath.html
#include <cassert>              // https://cpprefjp.github.io/reference/cassert/assert.html

using namespace std;

typedef long long ll;

#define GCD(a, b) __gcd((a), (b))
#define LCM(a, b) ((a) / GCD((a), (b)) * (b))

inline int popcount(int x) { return __builtin_popcount((x)); }
inline int popcount(ll x) { return __builtin_popcountll((x)); }

#ifdef AT_DEBUG
#define dp(s) (cout << s)
#define dpln(s) (cout << s << endl)
#define dpln_col(c) { for (const auto& x : c) dpln(x); }
#else  // AT_DEBUG
#define dp(s)
#define dpln(s)
#define dpln_col(c)
#endif // AT_DEBUG

int main (int argc, char** argv)
{
	int X, Y, Z;

	cin >> X >> Y >> Z;

	int tmp;

	tmp = X;
	X = Y;
	Y = tmp;

	tmp = X;
	X = Z;

	Z = tmp;

	cout << X << " " << Y << " " << Z << endl;
	
#ifdef AT_DEBUG
#endif  // AT_DEBUG

	return 0;
}

// Dec Hex    Dec Hex    Dec Hex  Dec Hex  Dec Hex  Dec Hex   Dec Hex   Dec Hex
//   0 00 NUL  16 10 DLE  32 20    48 30 0  64 40 @  80 50 P   96 60 `  112 70 p
//   1 01 SOH  17 11 DC1  33 21 !  49 31 1  65 41 A  81 51 Q   97 61 a  113 71 q
//   2 02 STX  18 12 DC2  34 22 "  50 32 2  66 42 B  82 52 R   98 62 b  114 72 r
//   3 03 ETX  19 13 DC3  35 23 #  51 33 3  67 43 C  83 53 S   99 63 c  115 73 s
//   4 04 EOT  20 14 DC4  36 24 $  52 34 4  68 44 D  84 54 T  100 64 d  116 74 t
//   5 05 ENQ  21 15 NAK  37 25 %  53 35 5  69 45 E  85 55 U  101 65 e  117 75 u
//   6 06 ACK  22 16 SYN  38 26 &  54 36 6  70 46 F  86 56 V  102 66 f  118 76 v
//   7 07 BEL  23 17 ETB  39 27 '  55 37 7  71 47 G  87 57 W  103 67 g  119 77 w
//   8 08 BS   24 18 CAN  40 28 (  56 38 8  72 48 H  88 58 X  104 68 h  120 78 x
//   9 09 HT   25 19 EM   41 29 )  57 39 9  73 49 I  89 59 Y  105 69 i  121 79 y
//  10 0A LF   26 1A SUB  42 2A *  58 3A :  74 4A J  90 5A Z  106 6A j  122 7A z
//  11 0B VT   27 1B ESC  43 2B +  59 3B ;  75 4B K  91 5B [  107 6B k  123 7B {
//  12 0C FF   28 1C FS   44 2C ,  60 3C <  76 4C L  92 5C \  108 6C l  124 7C |
//  13 0D CR   29 1D GS   45 2D -  61 3D =  77 4D M  93 5D ]  109 6D m  125 7D }
//  14 0E SO   30 1E RS   46 2E .  62 3E >  78 4E N  94 5E ^  110 6E n  126 7E ~
//  15 0F SI   31 1F US   47 2F /  63 3F ?  79 4F O  95 5F _  111 6F o  127 7F DEL


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

int main(){
    int a,b,c,d,e,f;
    cin>>a>>b;
    d = a/b;
    e = a%b;
    f = a/b;
    
    cout<<fixed<<setprecision(12);
    
    cout<<d<<" ";
    cout<<e<<" ";
    cout<<(double)a/b<<endl;
    
}


Measured memory_bytes: 3204
n=int(input())
if n<600 and n>399:
    print(8)
elif n<800 and n>599:
    print(7)
elif n<1000 and n>799:
    print(6)
elif n<1200 and n>999:
    print(5)
elif n<1400 and n>1199:
    print(4)
elif n<1600 and n>1399:
    print(3)
elif n<1800 and n>1599:
    print(2)
elif n<2000 and n>1799:
    print(1)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,a,b,sum_a=0,sum_b=0,count_a=0,count_b=0; cin>>N;
  vector<ll>A(N),B(N);
  for(int i=0; i<N; i++){
    cin>>a;
    A[i]=a;
    sum_a+=a;    
  }
  for(int i=0; i<N; i++){
    cin>>b;
    B[i]=b;
    sum_b+=b;
  }
  for(int i=0; i<N; i++){
    count_a+=max(0LL,(B[i]-A[i]+1)/2);
    count_b+=max(0LL,A[i]-B[i]);
  }
  if(sum_b>=sum_a && sum_b-sum_a>=max(count_a, count_b)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 384
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

H, W, K = MAP()
grid = [[]] * H
for i in range(H):
    grid[i] = list(input())

ans = 0
for bit1 in range(1<<H):
    for bit2 in range(1<<W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if grid[i][j] == '#' and (not bit1>>i & 1) and (not bit2>>j & 1):
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)


Measured memory_bytes: 68824
step = []
step[0] = [1.0, 0.0]
1000.times{|i|
  x, y = -step[-1][1], step[-1][0]
  r = Math.sqrt(x*x + y*y)
  step[i+1] = [step[i][0] + x/r, step[i][1] + y/r]
}

readlines.map(&:to_i).each{|i|
  break if i == -1
  puts step[i-1][0]
  puts step[i-1][1]
}

Measured memory_bytes: 8652
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF /*1000000007*/ 1000000000000000003
#define MOD 1000000007

using namespace std;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };

vector<edge>tree[100010];
vector<P> connect[100005];
long long cost[100005];

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

bool isSosu(long long num) {
	long long count = sqrt(num);
	if (num != 2 && num % 2 == 0)return false;
	for (int i = 3; i <= count; i+=2) {
		if (num%i == 0)return false;
	}
	return true;
}

int main() {

	long long A, B;
	cin >> A >> B; 

	long long small = A < B ? A : B;
	long long big = small == A ? B : A;
	long long count = sqrt(A);
	vector <long long> yakusu;
	for (long long i = 1; i <= count;++i) {
		if (small%i == 0) {
			if(big % i == 0 && isSosu(i)) yakusu.push_back(i);
			if (i != (small / i)) {
				if (big % (small / i) == 0 && isSosu(small / i)) yakusu.push_back((small / i));
			}
		}
	}
	
	long long ans = yakusu.size();
	cout << ans << endl;
}




Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ALDS1_6_A
{
    class Program
    {
        

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            int[] A = Console.ReadLine()
                             .Split(' ')
                             .Select(s => int.Parse(s))
                             .ToArray();
            int[] B = new int[A.Length];

            int[] cntAry = new int[10001];

            for (int i = 0; i < cntAry.Length; i++)
            {
                cntAry[i] = 0;
            }

            foreach (int i in A)
            {
                cntAry[i]++;
            }

            for (int i = 1; i < cntAry.Length; i++)
            {
                cntAry[i] += cntAry[i - 1];
            }

            foreach (int i in A)
            {
                B[cntAry[i] - 1] = i;
                cntAry[i]--;
            }

            Console.WriteLine(string.Join(" ", B));
            Console.ReadLine();
        }
    }
}



Measured memory_bytes: 180136
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

manzoku = 0
for i in range(n):
    manzoku += b[a[i]-1]
    if i == 0:
        continue
    elif a[i] - a[i-1] == 1:
        manzoku += c[a[i-1]-1]

print(manzoku)

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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	string s;
	cin >> s;
	vector<string> v = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
	int pos = find(v.begin(), v.end(), s) - v.begin();
	if(pos == 6) {
		cout << 7;
		return;
	}
	cout << 6 - pos << "\n";
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 3580
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

s=input().rstrip()
t=input().rstrip()

ans=10**10

for i in range(len(s)-len(t)+1):
    now=0
    for j in range(len(t)):
        if t[j]!=s[i+j]:
            now+=1
    ans=min(ans,now)
print(ans)

Measured memory_bytes: 9056
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007

using namespace std;
class CompareFirst
{
public:
  bool operator()(pair<int,int> n1,pair<int,int> n2) {
    return n1.first>n2.first; //>:desc <:asc
  }
};


int main(){

  string s,ans="Yes";
  int n;
  vector<string> vs;
  vector<int> vi;
  pair<int,int> pr;
  //unordered_map<string,int> mp;
  //priority_queue<int> pq; // default ‘å‚«‚¢‡
  //priority_queue<pair<int,int>,vector<pair<int,int>>,CompareFirst> pq;

  cin >> s;
  rep(i,0,sz(s)-1){
    if((i+1)%2 == 1){
      if(s[i] == 'L')ans = "No";
    }
    if((i+1)%2 == 0){
      if(s[i] == 'R')ans = "No";
    }
  }
//  printf("%.10f\n",ans);
  cout << ans << endl;
  return 0;

}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  set<int> s;
  s.insert(a);
  s.insert(b);
  s.insert(c);
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
/*
 * author: calgagi
 *         Calvin Gagliano 
 */
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define ar array
#define f first
#define s second
#define dd long double

int main() {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);
    srand(chrono::steady_clock::now().time_since_epoch().count()); 
    // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 
    
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC" : "ABC") << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
  int n,k;
  cin >> n >> k;
  int* x = new int[100000];
  for(int i=0;i<n;i++) cin >> x[i];

  int ans = 500000000;
  for(int i=0;i<=n-k;i++){
    if(x[i]>0&&x[i+k-1]>0 || x[i]<0&&x[i+k-1]<0){
      ans = min(ans,max(abs(x[i]),abs(x[i+k-1])));
    } else {
      ans = min(ans,abs(x[i])+abs(x[i+k-1])+min(abs(x[i]),abs(x[i+k-1])));
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
def main():
    n = int(input())
    alis = list(map(int, input().split()))
    blis = list(map(int, input().split()))
    ans = 0

    for i in range(n-1, -1, -1):
        if blis[i] <= alis[i+1]:
            ans += blis[i]
        elif blis[i] < alis[i+1] + alis[i]:
            ans += blis[i]
            alis[i] = alis[i] - (blis[i] - alis[i+1]) 
        elif blis[i] >= alis[i+1] + alis[i]:
            ans += alis[i] + alis[i+1]
            alis[i] = 0
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 97500
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;

void solve(){
  string s; cin >> s;
  int n = s.size();
  set<char> st;
  for(int i = 0; i < n; i++){
    st.insert(s[i]);
  }
  if(st.size() == n) cout << "yes\n";
  else cout << "no\n";
  return;
}

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


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

int main(){
    int A,B,N;
    cin>>N>>A>>B;
    int sum=0;
    for(int i=0;i<=N;i++){
        int count=0;
        for(int k=i;k>0;){
            count+=k%10;
            k/=10;
        }
            if(count>=A and count<=B){
                sum+=i;
            }

    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import math

if __name__ == '__main__':
    N = int(input())
    A = [int(c) for c in input().split()]
    R = [0 for i in range(N)]
    M = 0

    for i in range(N-1, -1, -1):
        # print('i={}'.format(i))
        start = i
        sum = 0
        for j in range(start, N, i + 1):
            # print('  j={}'.format(j))
            sum += R[j]
        # print(sum)
        # print(A[i])
        if sum % 2 != A[i]:
            R[i] = 1
            M += 1

    # print(R)

    print(M)
    if M != 0:
        for i in range(N):
            if R[i] == 1:
                print(i+1, end=' ')


Measured memory_bytes: 7276
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int check = 0;
		int a = n/100;
		int b = n-a*100;
		if(a*5>=b){
		    check = 1;
		}
		System.out.println(check);
    }
}

Measured memory_bytes: 35636
#include<stdio.h>

int main(void)
{
  int num[5];
  int temp;
  int i=4, j, k;
  
  scanf("%d %d %d %d %d", &num[0], &num[1], &num[2], &num[3], &num[4]);

  while(i>0){
    for(j=1; j<=i; j++){
      if(num[j-1] < num[j]){
	temp = num[j];
	num[j] = num[j-1];
	num[j-1] = temp;
      }
    }
    i--;
  }

  for(k=0; k<5; k++){
    printf("%d",num[k]);
    if(k<4)
      putchar(' ');
  }
  putchar('\n');

  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}

int main(){
  fastIO();
  ll n,red,blue;
  cin>>n>>blue>>red;
  ll div=n/(red+blue);
  ll rest=n%(red+blue);
  ll ans = (div*blue) + min(rest,blue);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
def choose(D, c, s, d, last, depth, p):
    maxpoint = -999999
    maxnum = 0
    if depth > 0 and d < D:
        for i in range(26):
            point = p
            point += s[d][i]
            point += changepoint(c, d, i, last)
            nlast = last
            nlast[i] = d
            z, point = choose(D, c, s, d+1, nlast, depth-1, point)
            if point > maxpoint:
                maxpoint = point
                maxnum = i
        return maxnum, maxpoint
    return 0, p


def changepoint(c, d, num, last):
    point = 0
    for i in range(26):
        if i == num:
            continue
        point -= c[i]*(d-last[i])
    return point


def main():
    D = int(input())
    c = list(map(int, input().split()))
    s = []
    last = [-1]*26
    for _ in range(D):
        s.append(list(map(int, input().split())))
    point = 0
    for i in range(D):
        num, point = choose(D, c, s, i, last, 2, point)
        print(num+1)


main()


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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

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

int const MAX = 2e3 + 41;
int const INF = 1e9 + 41;

int n, k, q;
int a[MAX];
int ans;

int b[MAX];

void prepare(int x, int y) {
	fi(1, n) {
		if (a[i] < x) {
			b[i] = 0;
		} else if (a[i] > y) {
			b[i] = 2;
		} else {
			b[i] = 1;
		}
	}
}

int get() {
	int q1 = 0;
	int q2 = 0;
	int res = 0;
	/*
	fi(1, n) {
		err("i = %d b[i] = %d\n", i, b[i]);
	}
	*/
	fi(1, n) {
		if (b[i] == 0) {
			q1 = q2 = 0;
			continue;
		}
		if (b[i] == 1) {
			q1++;
		} else {
			q2++;
		}
		if (q1 + q2 >= k) {
			if (q1 > 0) {
				res++;
				q1--;
//				err("i = %d res = %d q1 = %d q2 = %d\n", i, res, q1, q2);
			}
		}
	}
		
	
	return res;
}

void solve() {
	ans = INF;
	fi(1, n) {
		int l = a[i] - 1;
		int r = INF;		
		while (r - l > 1) {
			int h = (l + r) / 2;
			prepare(a[i], h);
			if (get() >= q) {
				r = h;
				ans = min(ans, r - a[i]);
			} else {
				l = h;
			}
		}				
	}
	printf("%d\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	scanf("%d %d %d", &n, &k, &q);
	fi(1, n) {
		scanf("%d", &a[i]);
	}  
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextLong()
    var ans = 0L
    for (X in 1..N) {
        val Y = N / X
        ans += Y * (Y + 1) * X / 2
    }
    println(ans)
}

Measured memory_bytes: 34632
#include<iostream>

using namespace std;

int main(){
  long long n, m;
  cin >> n >> m;
  if(n==1 && m==1){
    cout << 1 << endl;
  }
  else if(n==1 && m!=1){
    cout << m-2 << endl;
  }
  else if(n!=1 && m==1){
    cout << n-2 << endl;
  }
  else{
    cout << (m-2)*(n-2) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5+5 , M = 1e9+7, OO = 0x3f3f3f3f;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const double Pii = 3.14159265359;
ll n;
ll a[N], d[N], fr[N];

int main()
{
    FIO
    cin >> n;
    for(int i=0; i<n; ++i)
    {
        cin >> a[i];
        d[i] = i-a[i];
    }
    for(int i=0; i<n; ++i)
        if(d[i] < N && d[i] >= 0) fr[d[i]]++;
    ll ans =0;
    for(int i=0; i<n; ++i)
    {
        int didx = a[i]+i;
        if(didx >= 0 && didx < N) ans += fr[didx];
        //cout << didx << " " << fr[didx] << endl;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 8220
import sys
input = sys.stdin.readline

N=int(input())
A=[int(input())-1 for i in range(N)]
Q=[0]*N
for i in range(N):
    Q[A[i]]= i
#print(Q)
num=0
s=1
t=Q[0]
for i in range(1,N):
    if t>Q[i]:
        num=max(s,num)
        s=0
    s+=1
    t=Q[i]
    #print(s)
num=max(s,num)
print(N-num)

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

signed main() {
	int n, k;
	string s;
	cin >> n >> s >> k;

	for (int i = 0; i < s.size(); ++i) {
		if (s[i] != s[k - 1]) s[i] = '*';
	}

	cout << s << endl;
}	


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll n;
    cin >> n;
    map<ll, int> mp;
    for (ll i = 2; i * i <= n; ++i) {
        while(1) {
            if (n % i != 0) break;
            n /= i;
            ++mp[i];
        }
    }
    if (n != 1) ++mp[n];
    int ans = 0;
    for (auto p: mp) {
        int tmp = p.second;
        int idx = 1;
        while(1) {
            if (tmp - idx < 0) break;
            tmp -= idx;
            ++idx;
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處
const int MAXN = 2502;
vector<pair<int, int>> adj[MAXN];
vector<int> adj_inv[MAXN];

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M, P; cin >> N >> M >> P;
    for (int i = 0; i < M; ++i) {
        int a, b, c; cin >> a >> b >> c;
        adj[a].push_back(make_pair(b, -(c-P)));
        adj_inv[b].push_back(a);
    }

    // check which node could reach Nth node
    bool vis[MAXN];
    memset(vis, 0, sizeof(vis));
    queue<int> q;
    q.push(N);
    vis[N] = true;
    while (q.size()) {
        int s = q.front(); q.pop();
        for (int t : adj_inv[s]) {
            if (!vis[t]) {
                vis[t] = true;
                q.push(t);
            }
        }
    }

    // Belman-Ford
    int d[MAXN];
    for (int i = 1; i <= N; ++i)  d[i] = INT_MAX;
    d[1] = 0;
    for (int it = 0; it <= N; ++it) {
        bool update = false;
        for (int i = 1; i <= N; ++i) {
            for (auto e : adj[i]) {
                if (d[i] != INT_MAX && d[i] + e.second < d[e.first]) {
                    d[e.first] = d[i] + e.second;
                    if (vis[e.first])  update = true;
                }
            }
        }
        if (!update)  break;
        else if (it == N) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << max(-d[N], 0) << endl;

    return 0;
}


Measured memory_bytes: 3944
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 1e5+50;
const int inf = 1e9;

int x[maxn], y[maxn];
ll pre[maxn];

int main()
{
    //freopen("in", "r", stdin);
    int n, m, d;
    scanf("%d %d %d", &n, &m, &d);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
        {
            int a;
            scanf("%d", &a);
            x[a] = i;
            y[a] = j;
        }
    mst(pre);
    for (int i = 1; i <= d; ++i)
    {
        int p = i+d;
        while (p <= n*m)
        {
            pre[p] = pre[p-d] + abs(x[p]-x[p-d]) + abs(y[p]-y[p-d]);
            p += d;
        }
    }
    int Q;
    scanf("%d", &Q);
    while (Q--)
    {
        int l, r;
        scanf("%d %d", &l, &r);
        printf("%lld\n", pre[r]-pre[l]);
    }
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a;
    cin >> b;
//    int a = 4, b = 3;

    if (a < b) {
        cout << string(b, a + '0');
    } else {
        cout << string(a, b + '0');
    }

    return 0;
}

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

int dice[6];

void North()
{
	int d[6];
	d[0] = dice[1];
	d[1] = dice[5];
	d[5] = dice[3];
	d[3] = dice[0];
	d[2] = dice[2];
	d[4] = dice[4];
	for ( int i = 0; i < 6; ++i )
		dice[i] = d[i];
}

void East()
{
	int d[6];
	d[0] = dice[4];
	d[4] = dice[5];
	d[5] = dice[2];
	d[2] = dice[0];
	d[1] = dice[1];
	d[3] = dice[3];
	for ( int i = 0; i < 6; ++i )
		dice[i] = d[i];
}

void West()
{
	int d[6];
	d[0] = dice[2];
	d[2] = dice[5];
	d[5] = dice[4];
	d[4] = dice[0];
	d[1] = dice[1];
	d[3] = dice[3];
	for ( int i = 0; i < 6; ++i )
		dice[i] = d[i];
}

void South()
{
	int d[6];
	d[0] = dice[3];
	d[3] = dice[5];
	d[5] = dice[1];
	d[1] = dice[0];
	d[2] = dice[2];
	d[4] = dice[4];
	for ( int i = 0; i < 6; ++i )
		dice[i] = d[i];
}

void Right()
{
	int d[6];
	d[1] = dice[2];
	d[2] = dice[3];
	d[3] = dice[4];
	d[4] = dice[1];
	d[0] = dice[0];
	d[5] = dice[5];
	for ( int i = 0; i < 6; ++i )
		dice[i] = d[i];
}

void Left()
{
	int d[6];
	d[1] = dice[4];
	d[4] = dice[3];
	d[3] = dice[2];
	d[2] = dice[1];
	d[0] = dice[0];
	d[5] = dice[5];
	for ( int i = 0; i < 6; ++i )
		dice[i] = d[i];
}

int main( void )
{
	while (1)
	{
		dice[0] = 1;
		dice[1] = 2;
		dice[2] = 3;
		dice[3] = 5;
		dice[4] = 4;
		dice[5] = 6;

		int answer = 1;
		int n;
		cin >> n;

		if ( n == 0 )
			break;

		for ( int i = 0; i < n; ++i )
		{
			string o;
			cin >> o;

			if ( o[0] == 'N' )
				North();
			else if ( o[0] == 'E' )
				East();
			else if ( o[0] == 'W' )
				West();
			else if ( o[0] == 'S' )
				South();
			else if ( o[0] == 'R' )
				Right();
			else if ( o[0] == 'L' )
				Left();

			answer += dice[0];
		}

		cout << answer << endl;
	}

	return 0;
}

Measured memory_bytes: 0
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int n,a;
	cin>>n>>a;
	cout<<n*n-a;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int a[100010];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();
	for(int i=1;i<=n;++i)a[i]=gi();
	int ans=0;
	for(int l=1,r;l<=n;l=r+1){
		while(l<n&&a[l]==a[l+1])++l;
		r=l+1;while(r<n&&1ll*(a[l]-a[l+1])*(a[r]-a[r+1])>=0)++r;
		++ans;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {

        int N;
        cin >> N;
        if(65 <= N && N <= 90) cout << 1 << endl;
        else if(97 <= N && N <= 122) cout << 2 << endl;
        else cout << 0 << endl;
        return 0;
}



Measured memory_bytes: 3100
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
# mod = 998244353
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"
INF = 1<<32-1
# INF = 10**18

def main():
    n = int(ipt())
    ans = 0
    for i in range(1,n):
        ans += (n-1)//i

    print(ans)

    return None

if __name__ == '__main__':
    main()


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

#define pan(i,n) for(int i=0;i<n;i++)
#define pans(i,n,a) for(int i=a;i<n;i++)
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
#define inf 100007
#define P pair<ll,ll>

using namespace std; 

int main(){
    int n;
    cin>>n;
    vi v(n+1,0);
    pan(i,n-1){
        int x;
        cin>>x;
        v[x]++;
    }
    for(int i=1;i<=n;i++){
        cout<<v[i]<<endl;
}
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int D, G;
  int p[10], c[10];
  cin >> D >> G;
  for (int i = 0; i < D; i++) {
    cin >> p[i] >> c[i];
  }

  const int INF = 1 << 30;
  int ans = INF;
  for (int i = 0; i < 1 << D; i++) {
    int sum = 0, cnt = 0;
    for (int j = 0; j < D; j++) {
      if (i >> j & 1) {
        sum += p[j]*(j+1)*100+c[j];
        cnt += p[j];
      }
    }
    int rem = G - sum;
    if (rem > 0) {
      for (int j = D-1; j >= 0; j--) {
        if (i >> j & 1) continue;
        int pt = (j+1)*100;
        if (rem - (p[j]-1)*pt > 0) {
          rem -= (p[j]-1)*pt;
          cnt += p[j]-1;
        } else {
          cnt += (rem+pt-1)/pt;
          rem -= (rem+pt-1)/pt*pt;
          break;
        }
      }
    }
    if (rem <= 0) ans = min(ans, cnt);
  }
  cout << ans << endl;

  return 0;
}

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

typedef long long ll;

#define F first 
#define S second 
#define PB push_back
#define MP make_pair 
#define rep(i,a,b) for (ll i=a;i<b;i++)
const ll INF = 1LL << 60;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pl;


int main()
{
    long x;
    cin>>x;

    long res = 0;

    res = res + (x/500)*1000;

    x = x%500;

    res += (x/5)*5;

    cout<<res<<endl;

    return 0; 
}



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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int dis[505][505];
int remain[505][505];
int x_ar[] = {-1, 0, 0, 1}, y_ar[] = {0, -1, 1, 0};
int n;

void update(int x_now, int y_now) {
    int value = dis[x_now][y_now];
    dis[x_now][y_now]--;
    rep(j, 4) {
        int x_next = x_now + x_ar[j], y_next = y_now + y_ar[j];
        if (x_next < 0 || n <= x_next || y_next < 0 || n <= y_next) {
            continue;
        }
        if (dis[x_next][y_next] == value + remain[x_next][y_next]) {
            update(x_next, y_next);
        }
    }
}

int main() {
source:
    cin >> n;
    int p[n * n];
    rep(i, n * n) {
        cin >> p[i];
        p[i]--;
    }

    rep(i, n) {
        rep(j, n) {
            int d = min(min(i, n - i - 1), min(j, n - j - 1));
            dis[i][j] = d + 1;
        }
    }

    rep(i, n) {
        rep(j, n) { remain[i][j] = 1; }
    }

    int ans = 0;
    rep(i, n * n) {
        int num = p[i];
        int x = num / n, y = num % n;
        ans += dis[x][y] - 1;
        remain[x][y] = 0;
        update(x, y);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 25384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define ssd ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)
#define MOD 1000000009
typedef long long int ll;
using namespace std;
using namespace __gnu_pbds;

ll max(ll a,ll b)
{
    if(a>=b)
        return a;
    else
        return b;
}

int main()
{
	ssd
	#define task "TASK"
	 //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=LLONG_MIN;

    ans=max(ans,a*c);
    ans=max(ans,b*c);
    ans=max(ans,a*d);
    ans=max(ans,b*d);
    cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 = 1LL << 60;

//input
ll h[100010];

//DP Table
ll dp[100010];

int main() {

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

    //initialize
    for (int i = 0; i < 100010; ++i) {
        dp[i] = INF;
    }

    //First Condition
    dp[0] = 0;

    //loop
    for (int i = 0; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        for (int j = 1; j <= K; ++j) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
char mp[10001][10000];

signed main() {
  int b;
  while (cin >> b) {
    if (b == 0) break;
    int a = 0, n = 0;
    for (int i = 1; i < sqrt(2 * b); i++) {
      int tmp = (2 * b / i - i + 1);
      if (2 * b % i == 0 && tmp % 2 == 0 && tmp / 2 >= 1) {
        if (n < i) {
          n = i;
          a = tmp / 2;
        }
      }
    }
    cout << a << ' ' << n << endl;
  }

  return 0;
}



Measured memory_bytes: 3048
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

const ll N = 1111111;

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


	vector<ll> mp(N);
	ll n;cin >> n;
	vector<ll> v(n);

	REP(i, n){
		cin >> v[i];
		mp[v[i]]++;
	}

	REV(i, N){
		if(mp[i] == 0)continue;
		for(ll j = 2 * i;j < N;j += i)mp[j] += mp[i];
	}

	ll out = 0;
	REP(i, n){
		//cout << v[i] << " " << mp[v[i]] << endl;
		if(mp[v[i]] == 1)out++;
	}
	cout << out << endl;

	return 0;
}


Measured memory_bytes: 13492
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, x, mini = 10000, sum = 0;
  cin >> n >> x;
  for(int i = 0; i < n; i++){
    int cur;
    cin >> cur;
    sum += cur;
    mini = min(mini, cur);
  }
  cout << n + (x - sum) / mini << endl;
}


Measured memory_bytes: 256