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

using Edges=vector<int>;
using Graph=vector<Edges>;
const int HALF=20;
vector<int> dp0(1<<HALF);
vector<int> vs0(HALF,0);
vector<int> dp1(1<<HALF);
vector<int> vs1(HALF,0);
int solve(Graph& g,vector<int>& b){
    int n=g.size();
    if(n==1){
        return b[0];
    }
    int half=n/2;
    int rest=n-half;
    const int INF=1e6;
    for(int i=0;i<half;i++){
        vs0[i]=0;
        for(int j=0;j<g[i].size();j++){
            if(g[i][j]<half) vs0[i]|=(1<<g[i][j]);
        }
    }
    for(int i=1;i<(1<<half);i+=2){
        int vs=0;
        int val=0;
        for(int j=0;j<half;j++){
            if((1<<j)&i){
                val+=b[j];
                vs|=vs0[j];
            }
            if(vs&i) val=-INF;
            dp0[i]=val;
        }
    }

    
    for(int i=0;i<rest;i++){
        vs1[i]=0;
        for(int j=0;j<g[i+half].size();j++){
            if(g[i+half][j]>=half) vs1[i]|=(1<<(g[i+half][j]-half));
        }
    }
    for(int i=0;i<(1<<rest);i++){
        bool isok=true;
        int vs=0;
        int val=0;
        for(int j=0;j<rest;j++){
            if((1<<j)&i){
                val+=b[j+half];
                vs|=vs1[j];
            }
            if(i&vs) val=-INF;
            dp1[i]=val;
        }
    }
    for(int i=0;i<(1<<rest);i++){
        for(int j=0;j<rest;j++){
            dp1[i|(1<<j)]=max(dp1[i|(1<<j)],dp1[i]); 
        }
    }

    vector<int> vs01(half,0);
    for(int i=0;i<half;i++){
        for(int j=0;j<g[i].size();j++){
            if(g[i][j]>=half) vs01[i]|=(1<<(g[i][j]-half));
        }
    }
    int res=0;
    vector<int> opn(1<<half,(1<<rest)-1);
    for(int i=1;i<(1<<half);i+=2){
        int opn=(1<<rest)-1;
        for(int j=0;j<half;j++){
            if(i&(1<<j)) opn&=~vs01[j];
        }
        res=max(res,dp0[i]+dp1[opn]);
    }
    return res;
}

int main(){
    //ios_base::sync_with_stdio(false);
    int n;
    while(cin>>n,n){
        vector<string> a(n);
        vector<int> b(n);
        vector<int> c(n);
        vector<vector<string>> d(n);
        for(int i=0;i<n;i++){
            cin>>a[i]>>b[i]>>c[i];
            d[i].assign(c[i],"");
            for(int j=0;j<c[i];j++){
                cin>>d[i][j];
            }
        }

        map<string,int> dic;
        for(int i=0;i<n;i++) dic[a[i]]=i;
        Graph g(n);
        for(int i=0;i<n;i++){
            for(int j=0;j<c[i];j++){
                int v=dic[d[i][j]];
                g[i].push_back(v);
            }
        }
        cout<<solve(g,b)<<"\n";
    }
    return 0;
}


Measured memory_bytes: 15392
#include <stdio.h>
int main(void){
  int N,A,S;
  
  scanf("%d",&N);
  scanf("%d",&A);
  
  S=N%500;
  
  if(S<=A){
   printf("Yes");
  }
  else{
    printf("No");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
  long long int step[31]={1,1,2};
  for(int i=3; i<31; i++){
    step[i] = step[i-1]+step[i-2]+step[i-3];
  }
  int n;
  while(cin >>n,n){
    cout <<(step[n]+3649)/3650<<endl;
  }
}

Measured memory_bytes: 1156
import java.util.Scanner;
public class Main {
  public static int getFib(int n) {
    if (n == 0)
      return 1;
    if (n == 1)
      return 1;
    int j = 1;
    int k = 1;
    int sum = 0;
    for (int i = 2; i <= n; i++) {
      sum = j + k;
      j = k;
      k = sum;
    }
    return sum;
  }
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    s.close();
    System.out.println(getFib(n));
  }
}



Measured memory_bytes: 26264
import numpy as np

N, K = map(int, input().split())
MAX_DIGIT = 50
A = [int(_) for _ in input().split()]
dp = np.full((MAX_DIGIT+1, 2), -1, dtype=np.int64)
dp[0][0] = 0

for d in range(MAX_DIGIT):
    mask = 1 << (MAX_DIGIT - 1 - d)
    onenum = 0
    for i in A:
        if (i & mask) == mask:
            onenum += 1
    
    cost0 = mask * onenum
    cost1 = mask * (N - onenum)
    
    if dp[d][1] != -1:
        dp[d+1][1] = max(dp[d+1][1], dp[d][1] + max(cost0, cost1))
    
    if dp[d][0] != -1:
        if K & mask:
            dp[d+1][1] = max(dp[d+1][1], dp[d][0] + cost0)
    
    if dp[d][0] != -1:
        if K & mask:
            dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost1)
        else:
            dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost0)

print(max(dp[MAX_DIGIT][0], dp[MAX_DIGIT][1]))

Measured memory_bytes: 23604
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();
        int K = nextInt();
        int[] H = new int[N];
        Arrays.setAll(H, i->nextInt());

        Arrays.sort(H);

        long sum = 0;
        for(int i=0; i<N-K; i++){
            sum += H[i];
        }

        println(sum);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


Measured memory_bytes: 54392
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <math.h>
#include <map>
#include <set>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll INF = 1000000000000000000LL;
using namespace std;

const int MOD = 1000000007;

ll beki(ll a, ll b)
{
    if(b == 0)return 1;
    //bit shift
    ll res = beki(a, b/2);
    res *= res;
    if(b % 2 == 1)
    {
        res *= a;
    }
    return res;
}


int main(){
    ll n,k;
    cin >> n >> k;
    ll res = 1;

    //K * (K-1) * (K-1) がn個

    res = beki(k-1, n-1);
    res *= k;

    cout << res << endl;

    return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int count[256] = {0};
    for (char c : s) count[(int)c]++;
    ll ans = 0;
    for (char c : s) {
        count[(int)c]--;
        ll x = 1;
        for (int d = 'a'; d <= 'z'; d++) if (d != c) {
            x = (x * (count[d]+1)) % MOD;
        }
        ans = (ans + x) % MOD;
    }
    cout << ans << '\n';
}


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

#define reg register
#define pr std::pair<int, int>
#define fi first
#define se second
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define lep(i, l, r) for (int i = l; i < r; ++i)
#define irep(i, r, l) for (int i = r; i >= l; --i)
#define ilep(i, r, l) for (int i = r; i > l; --i)
#define Rep(i, n) rep(i, 1, n)
#define Lep(i, n) lep(i, 1, n)
#define IRep(i, n) irep(i, n, 1)
#define ILep(i, n) ilep(i, n, 1)
typedef long long ll;
typedef long double ld;

namespace modular {
    const int MOD = 1000000007;
    inline int add(int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }
    inline void inc(int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }
    inline int mul(int x, int y) { return 1LL * x * y % MOD; }
    inline int qpow(int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x))
            if (y & 1) ans = mul(ans, x);
        return ans;
    }
};  // namespace modular

namespace Base {
    template <typename Tp>
    inline Tp input() {
        Tp x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        return x *= y;
    }
    template <typename Tp>
    inline void read(Tp &x) {
        x = input<Tp>();
    }
    template <typename Tp>
    inline void chmax(Tp &x, Tp y) {
        x < y ? x = y : 0;
    }
    template <typename Tp>
    inline void chmin(Tp &x, Tp y) {
        x > y ? x = y : 0;
    }
};  // namespace Base
using namespace Base;
/*----------------------------------------------------------------------------*/

#define MAX_N 1007

int N, K;
int mp[MAX_N][MAX_N];

int main() {
#ifdef LOCAL
    FIN("in");
#endif
    read(K);
    N = std::min(500, K);
    Rep(i, N) {
        int x = 1, y = i;
        Rep(j, N) {
            mp[x][y] = i;
            x = x % N + 1, y = y % N + 1;
        }
    }
    rep(i, N + 1, K) {
        int x = 1, y = i - N;
        Rep(j, N) {
            if (j & 1) mp[x][y] = i;
            x = x % N + 1, y = y % N + 1;
        }
    }
    printf("%d\n", N);
    Rep(i, N) {
        Rep(j, N) printf("%d ", mp[i][j]);
        puts("");
    }
    return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;
}
// ----------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  ll sum=0;
  for(int i=0; i<N; i++){
    cin >> a[i];
    sum += a[i];
  }
  sort(a.begin(),a.end());
  cout << a[0] << " " << a[N-1] << " " << sum << endl;
  return 0;
}



Measured memory_bytes: 3192
#include<ctime> 
#include<cmath> 
#include<cstdio>  
#include<cstring> 
#include<algorithm>
#define gc getchar() 
#define pc putchar 
#define rep for(a,b,c) for(int a = b;a <= c;++ a) 
#define per for(a,b,c) for(int a = b;a >= c;-- a) 
inline int read() { 
	 int x = 0,f = 1; 
	 char c = gc; 
	 while(c < '0' || c > '9') c = gc; 
	 while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = gc; 
	 return x * f; 
} 
void print(int x) {
	if(x < 0) { 
		pc('-'); 
		x = -x; 
	} 
	if(x >= 10) print(x / 10); 
	pc(x % 10 + '0'); 
} 
const int maxn = 1000007; 
bool solve() { 
	static int a[maxn]; 
	int n = read(); 
	int mx = 0,mn = 0x3f3f3f3f; 
	for(int i = 1;i <= n;++ i)  { 
		a[i] = read(); 
		mx = std::max(mx,a[i]); 
		mn = std::min(mn,a[i]); 
	}  
	if(mx - mn >= 2) return true; 
//	if(mx == n - 1 && mn != n - 1) return true; 
	int c1 = 0,c2 = 0; 
	for(int i = 1;i <= n;++ i) { 
		if(a[i] == mx) c1 ++; 
		else c2 ++ ;
	} 
	int sum = mx; 
	if(mx != mn) {   
		int res = sum - c2; 
		if(res <= 0) return true; 
		if(c1 < res * 2) return true; 
	} 
	if(mx == mn) { 
		sum ++; 
		if(mx == n - 1) return false; 
		if(mx * 2 > n) { 
			return true; 
		} 
	} 
	return false;
	
} 
int main() { 
		puts(solve() ? "No" : "Yes");  
} 

Measured memory_bytes: 512
n = int(input())

tmp = [0]
a = []
b = []
ans = 0
for i in range(n):
  tmp[0] = list(map(int,input().split()))
  a.append(tmp[0][0])
  b.append(tmp[0][1])
  
ans = max(a)
#print(ans)
print(ans+min(b))


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

int main() {
  int n;
  cin>>n;
  int a[100];
  int sum=0;
  for(int i=0;i<n;i++){
  cin >>a[i];
  sum+=a[i];
 }
 int sub1=0,sub2=0;
 for(int i=0;i<n;i++){
   sub1 +=a[i];
   if(sub1*2>=sum) break;
   sub2 = sub1;
 }
 //cout<<sub1<<endl;
  //cout<<sub2<<endl;
 // cout<<sum<<endl;
cout<<min(abs(sub1-(sum-sub1)),abs(sub2-(sum-sub2)))<<endl;

}


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int N, M;
    cin >> N >> M;
    pair<ll, int> AB[N];
    for(int i = 0; i < N; i++) {
        ll A;
        int B;
        cin >> A >> B;
        AB[i] = make_pair(A, B);
    }
    sort(AB, AB + N);
    ll ans = 0;
    for(int i = 0; i < N && M; i++) {
        ll A;
        int B;
        tie(A, B) = AB[i];
        int C = min(M, B);
        ans += A * C;
        M -= C;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
h, n = map(int, input().split())
a, b = [], []
for _ in range(n):
    _a, _b = map(int, input().split())
    a.append(_a)
    b.append(_b)

dp = [[float("inf")]*(h+1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
    for j in range(h+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][min(j+a[i], h)] = min(dp[i+1][min(j+a[i], h)], dp[i+1][j] + b[i])

print(dp[n][h])


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

int main() {
  string S;
  cin >> S;
  S += '0';
  int ans = 0;
  for (int i = 0; i + 1 < S.size(); i++) {
    int n = S.at(i) - '0';
    ans += min(n, 10 - n);
    if (n >= 6 || n == 5 && S.at(i + 1) >= '5') S.at(i + 1)++;
  }
  ans += S.back() - '0';
  cout << ans << "\n";
}

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

int main()
{
    long long int a, b, n, v, i, max, tmp;
    scanf("%lld %lld %lld", &a, &b, &n);
    max=0;
    if (n<b) {
        max=floor(a*n*1.00/b);
    }
    else {
        max=floor(a*(b-1)*1.00/b);

    }
    printf("%lld\n", max);
    return 0;
}


Measured memory_bytes: 2216
#include<stdio.h>
int main(void){
    int a,b,i;
    char op;
    for(i=1;i>0;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+'){
            printf("%d\n",a+b);
        }
        if(op=='-'){
            printf("%d\n",a-b);
        }
        if(op=='*'){
            printf("%d\n",a*b);
        }
        if(op=='/'){
            printf("%d\n",a/b);
        }
        if(op=='?'){
            break;
        }
    }    
    return 0;
}


Measured memory_bytes: 2052
#include<iostream>
using namespace std;
int main () {
  int d[4];
  cin >> d[0] >> d[1] >> d[2] >> d[3];
  int a[] = {1, 9, 7, 4};
  int can = 0;
  for (int i = 0; i < 4; i ++) {
    for (int j = 0; j < 4; j ++) {
      if (d[i] == a[j]) {
        can ++;
        a[j] = 10;
      }
    }
  }
  if (can == 4) cout << "YES" << endl;
  else cout << "NO" << endl;
}
        



Measured memory_bytes: 256
//ABC 077
#include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int vx[4] = { 0,1,0,-1 };
int vy[4] = { 1,0,-1,0 };

string s,s2;

signed main() {

	std::ios::sync_with_stdio(false);
	std::cin.tie(0);


	cin >> s >> s2;
	if (s[0] == s2[2] && s2[0] == s[2] && s[1] == s2[1]) {
		cout << "YES";
	}
	else cout << "NO";


	return 0;

}

Measured memory_bytes: 256
import java.util.Map.Entry;
import java.io.*;
import java.util.*;

public class Main {
	
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		String S = sc.next();
		long ans = 0;
		long w = 0;
		for(int i = 0; i < S.length(); i++){
			if(S.charAt(i) == 'W'){
				if(w == 0){
					ans += i;
				}else{
					ans += (i - w);
				}
				w++;
			}
		}
		System.out.println(ans);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 25684
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)

#define FOREACH(x,a) for(auto&& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>

#define pb(a) push_back(a)
#define mp make_pair

int main(){
    CIN(n,t);VC2(n,a,b);
    ll ans = LINF;
    REP(i,n)if(b[i]<=t)ans=min(ans,a[i]);if(ans==LINF)EN(TLE);COUT(ans);
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < word.length(); i+=2) {
            builder.append(word.charAt(i));
        }
        System.out.println(builder);
    }
}


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

long long gcd(long long a, long long b){
  if(a < b) swap(a, b); 
  if(a % b == 0) return b;
  else return gcd( a - b, b);
}

int main(){
  long long n,m;
  cin >> n;
  vector<long long> v(n,0);
  r(i,n)cin >> v.at(i);
  r(i,n){
    if(!i)m=gcd(v.at(0),v.at(1));
    else m=gcd(m,v.at(i));
  }
               cout << m << endl;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(void)
{
  int h1,m1,h2,m2,k; cin>>h1>>m1>>h2>>m2>>k;
  int rm=60-m1; h1++;
  int rh=(h2-h1)*60;
  
  cout<<rh+rm+m2-k<<endl;
  return 0;
}

Measured memory_bytes: 3596
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if x in a and y in a or x in b and y in b or x in c and y in c:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

struct st
{
   string s;
   int t;
   /* data */
};


int main()
{
   int n;
   cin >> n;
   vector<st> list(n);
   rep(i,n)
   {
      int a;
      string b;
      cin >> b;
      cin >> a;
      
      list[i].s=b;
      list[i].t=a;
   }
   string now;cin >> now;
   
   bool hoge =false;
   int ans = 0;
   rep(i,n)
   {
      
      if(hoge)ans += list[i].t;
      if(list[i].s==now)
      {
         hoge=true;
      }
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
  int D, N;
  scanf("%d %d", &D, &N);

  int res;
  for (res = 1; true; ++res) {
    int count = 0;
    for (int j = res; j % 100 == 0; j /= 100) ++count;
    if (count == D) --N;
    if (N == 0) break;
  }
  printf("%d\n", res);
}

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

#define ll long long int
#define debug(c) cout << #c << " = " << c << endl;

int main()
{
  ll i,n,sum=0;
  cin>>n;
   for(i=1;i<=n;i++)
   {
       if(i%3!=0 && i%5!=0)
       {
           sum=sum+i;
       }
   }
   cout<<sum;
   return 0;
}


Measured memory_bytes: 3588
<?php
//ガウスジョルダン法

$count = 2;	//未知数の数
$value = array();	//係数配列

while(1){
	$res =fscanf(STDIN, '%d %d %d %d %d %d', $a,$b,$c,$d,$e,$f);
	if ($res==0) break;
	
	$value[0][0]=$a;  $value[0][1]=$b;  $value[0][2]=$c;
	$value[1][0]=$d;  $value[1][1]=$e;  $value[1][2]=$f;
	
	// $a or $e が０だと処理が止まるので入れ替えておく
	if ($a===0 && $e===0){
		//両方とも０なら計算する必要なし
		$y = $c/$b;  $x = $f/$d;
		$x = round($x, 3);  $y = round($y, 3);
		$x = sprintf('%.3f', $x);  $y = sprintf('%.3f', $y); 
		echo $x.' '.$y.PHP_EOL;
		continue;
	} else if ($a===0 || $e===0) {
		$value[0][0]=$d;  $value[0][1]=$e;  $value[0][2]=$f;
		$value[1][0]=$a;  $value[1][1]=$b;  $value[1][2]=$c;
	}
	
	for($i=0; $i<$count; ++$i){
		//注目式の未知数の係数を1にするためにその係数を格納
		$a = $value[$i][$i];
		
		//注目式の未知数の係数を1にするために注目式全体をaで割る
		for($j=$i; $j<=$count; ++$j){
			$value[$i][$j] = $value[$i][$j]/$a;
		}
		
		//注目式以外の未知数の係数を0にする
		for($j=0; $j<$count; ++$j){
			//注目式ならばスルー
			if ($j===$i) continue;
			//注目式以外の未知数の係数を格納
			$tmp = $value[$j][$i];
			//その値を0にするため、注目式との演算を行う
			for($k=0; $k<=$count; ++$k){
				//$value[$i][$k] が注目式の該当未知数の係数
				$value[$j][$k] = $value[$j][$k] - $tmp*$value[$i][$k];
			}
		}
	}
	
	//計算結果
	$x = $value[0][2];  $y = $value[1][2];
	$x = round($x, 3);  $y = round($y, 3);
	$x = sprintf('%.3f', $x);  $y = sprintf('%.3f', $y);
	echo $x.' '.$y.PHP_EOL;
}

Measured memory_bytes: 6700
#include <bits/stdc++.h>
using namespace std;
int n,ans = 0,new_ans;
string s;
int main(){
	cin >> n >> s;
	for (int i = 0;i < s.size();++i){
		if(s[i] == 'I')new_ans++;
		else new_ans--;
		ans = max(ans,new_ans);
	}
	cout << ans;
}

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

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

	int n;
	string s;
	cin>>n>>s;
	int a[n][2];
	if(s[0]=='.'){
		a[0][0]=0;
		a[0][1]=1;
	}
	else{
		a[0][0]=1;
		a[0][1]=0;
	}
	for(int i=1;i<n;i++){
		if(s[i]=='.'){
			a[i][0]=a[i-1][0];
			a[i][1]=min(a[i-1][0],a[i-1][1])+1;
		}
		else{
			a[i][0]=a[i-1][0]+1;
			a[i][1]=min(a[i-1][0],a[i-1][1]);
		}
	}
	cout<<min(a[n-1][0],a[n-1][1])<<"\n";
	return 0;
}

Measured memory_bytes: 2196
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define endl "\n"
    #define fi first
    #define se second
    #define pb push_back
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define For(i,n) for(ll i=0;i<n;i++)
    #define what(x) cerr << #x << " is " << x << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> omultiset;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> oset;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> oset1;
/*.....................................................................................................................*/
 
    const ll mod=998244353;
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
    long long binpow(long long x, long long p) 
    {
        if (p == 0) {return 1;} 
    	if (p == 2 || (p & 1)) {return mult(x, binpow(x, p - 1));}
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}
    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    const ll man=200005,inf=1e14;

/*......................................................................................................................*/

signed main()
{
    fast;
    ll n;
    cin>>n;
    ll a[n],b[n-1];
    For(i,n)a[i]=inf;
    For(i,n-1)cin>>b[i];
    a[0]=b[0];
    a[1]=b[0];
    a[n-2]=b[n-2];
    a[n-1]=b[n-2];
    f(i,1,n-1)a[i]=min({a[i],b[i],b[i-1]});
    ll ans=0;
    For(i,n)ans+=a[i];
    cout<<ans<<endl;
} 

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

int main(){
    string S;
    cin >> S;
    if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <set>

using namespace std;

int main(){
    set<int> res;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            res.insert(i*j);
        }
    }
    int n;
    scanf("%d",&n);
    if(res.count(n)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


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

int main(void){
    int D, G;
    cin >> D >> G;
    vector<int> p(D), c(D);

    for(int i=0; i<D; i++){
        cin >> p.at(i) >> c.at(i);
    }

    int maxbit = (int)pow(2,D), bit = 0;
    int ans = 1000;
    while(bit < maxbit){
        int cnt = 0, score = 0, max0 = -1;
        for(int i=0; i<D; i++){
            if(bit & (1<<i)){
                score += p.at(i)*(i+1)*100 + c.at(i);
                cnt += p.at(i);
            }else{
                max0 = i;
            }
        }

        int cnt2 = 0;
        while(max0 >= 0 && score < G && cnt2 < p.at(max0)-1){
            score += (max0 + 1)*100;

            cnt++;
            cnt2++;
        }

        if(score >= G){
            ans = min(ans, cnt);
        }

        bit++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <map>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <iostream>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  string a, b, c;
  int n;
  cin >> n >> a >> b >> c;
  int ans = 0;
  REP(i,n){
    map<char, int> m;
    m[a[i]]++; m[b[i]]++; m[c[i]]++;
    int mx = 0;
    for(auto a : m){
      mx = max(mx, a.second);
    }
    ans += 3 - mx;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1
mod=10**9+7

def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        count=0
        while n % i==0:
            count+=1
            n = n//i
        if count!=0:
            ass.append((i,count))
    if n != 1:
        ass.append((n,1))
    return ass

data=[1]*10**4
n=int(input())
for i in range(2,n+1):
    for ai ,c in prime_factor(i):
        data[ai]=(data[ai]+c)%mod
for di in data:
    pro*=di
    pro%=mod
print(pro)


Measured memory_bytes: 3444
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll K;
string s;
int main(){
    cin>>s>>K;
    K--;
    for(ll i=0;i<s.length();i++){
        if(s[i]!='1' && K>=i){
            cout<<s[i]<<endl;
            return 0;
        }
    }
    cout<<"1"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;

using Graph = vector<vector<int>>;

int main()
{
    ll a;
    string b;
    cin >> a >> b;
    ll c = (b[0]-'0')*100 + (b[2]-'0')*10+(b[3]-'0');
    cout<<a*c/100<<endl;

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, k;
    cin >> n >> k;
    
    int R, S, P;
    cin >> R >> S >> P;
    
    string t;
    cin >> t;
    
    int ans = 0;
    map<char, int> mp;
    mp['r'] = P;
    mp['s'] = R;
    mp['p'] = S;
    
    for (int i = 0; i < n; i++){
        if (i < k){
            if (t[i] == 'r') ans += mp['r'];
            else if (t[i] == 's') ans += mp['s'];
            else  ans += mp['p'];
        }
        else{
            if (t[i] == t[i-k]){
                t[i] = 'z';
            }
            else{
                if (t[i] == 'r') ans += mp['r'];
                else if (t[i] == 's') ans += mp['s'];
                else  ans += mp['p'];
            }
        }
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 512
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N;
int num[10000];
int box[10000];
int t, b;
int ans;
int bag;
int fig;
int color;

int main(){
	cin >> N;
	while (N) {
		for (int i = 0; i < N; i++) {
			cin >> num[i];
			num[i]--;
		}
		ans = N;
		for (int i = 0; i < N; i++) {
			box[i] = num[i];
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 3; j++) {
				if (box[i] == j)continue;
				box[i] = j;
				bag = 1;
				t = i;
				b = i;
				for (int k = t - 1; k >= 0; k--) {
					if (num[k] == j) {
						bag++;
						t = k;
					}
					else break;
				}
				for (int k = b + 1; k < N; k++) {
					if (num[k] == j) {
						bag++;
						b = k;
					}
					else break;
				}
				if (bag < 4) {
					box[i] = num[i];
					continue;
				}
				fig = 0;
				while (bag > 3) {
					fig += bag;
					ans = min(ans, N - fig);
					bag = 0;
					if (t - 1 < 0)continue;
					if (b + 1 >= N)continue;
					color = t - 1;
					for (int k = t - 1; k >= 0; k--) {
						if (num[k] == num[color]) {
							bag++;
							t = k;
						}
						else break;
					}
					for (int k = b + 1; k < N; k++) {
						if (num[k] == num[color]) {
							bag++;
							b = k;
						}
						else break;
					}
				}
			}
		}
		cout << ans << endl;
		cin >> N;
	}
	return 0;
}

Measured memory_bytes: 3136
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define MOD 1000000007
#define INF 1000000007
using namespace std;
//
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin>>S;
  int cnt=0;
  if(S[0]=='1'){
    cnt++;
  }
  if(S[1]=='1'){
    cnt++;
  }
  if(S[2]=='1'){
    cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<map>
#include<string>
#include<queue>
#include<iostream>
#define N 3
#define N2 9
using namespace std;
static const char c[4] = {'u', 'd', 'l', 'r'};
static const int x[4] = {-1, 1, 0, 0};
static const int y[4] = {0, 0, -1, 1};
struct Puzzle
{
  int f[N2];  int space; // f[] to record number sequence, space to record the location of number '0';
  string path;
  bool operator < (const Puzzle &p) const
  {
    for(int i=0; i<N2; i++)
    {
      if(f[i] == p.f[i])  continue;
      else return f[i] < p.f[i];
    }
    return false;
  }
};

bool istarget(Puzzle p)
{
  for(int i=0; i<N2; i++)
  {
    if(p.f[i] == i+1)
      continue;
    else return false;
  }
  return true;
}

string bfs(Puzzle& p)
{
  queue<Puzzle> PQ;
  Puzzle u, v;
  p.path = "";
  map<Puzzle, bool> V;
  V[p] = true;
  PQ.push(p);
  while(!PQ.empty())
  {
    u = PQ.front(); PQ.pop();
    if(istarget(u)) {return u.path;}
    int sx, sy, tx, ty;
    sx = u.space/N; sy = u.space % N;
    for(int r=0; r<4; r++)
    {
      tx = sx + x[r]; ty = sy + y[r];
      if(tx>=N || tx<0 || ty>=N || ty<0) continue;
      v = u; v.space = tx*N + ty;v.path += c[r];
      swap(v.f[sx*N + sy], v.f[tx*N + ty]);

      if(V.find(v) == V.end())
      {
        V[v] = true;PQ.push(v);
      }
    }
  }
  return "unsolvable";
}
int main()
{
  Puzzle input;
  for(int i=0; i<N2; i++)
  {
    scanf("%d", &input.f[i]);
    if(input.f[i] == 0)
    {
      input.f[i] = N2;
      input.space = i;
    }
  }
  string ans = bfs(input);
  cout << ans.size() << endl;
  return 0;
}



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

typedef long long ll;

int main(void){
    ll x, y;
    cin >> x >> y;
    ll z = y / x, ans = 0;
    while(z > 0){
        z /= 2;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    
    int n,ans=0;
    cin >> n;
    vi b(n+1);
    rep(i,1,n)cin >> b[i];
    b[0] = 100000;
    b[n] = 100000;

    rep(i,1,n+1){
        ans += min(b[i],b[i-1]);
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double pi = 3.14159265358979323846;

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
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;
}
//

bool used[101010], ok[101010];
int ans[101010];
int p[101010];
string s[101010];

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

  int n, m;
  cin >> n >> m;
  rep(i, m) { cin >> p[i] >> s[i]; }

  int ac = 0, pn = 0;
  rep(i, m) {
    if (s[i] == "WA") {
      ans[p[i]]++;
    } else {
      used[p[i]] = true;
    }
    if (used[p[i]] && !ok[p[i]]) {
      ok[p[i]] = true;
      pn += ans[p[i]];
      ac++;
    }
  }

  cout << ac << " " << pn << endl;

  return 0;
}

Measured memory_bytes: 6656
n = int(input())
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))
ans = 0
for i in range(n):
  if li_a[i] < li_b[i]:
    if li_b[i] >= li_a[i] + li_a[i+1]:
      ans += li_a[i] + li_a[i+1]
      li_a[i+1] = 0
    else:
      ans += li_b[i]
      li_a[i+1] = li_a[i+1] - (li_b[i]-li_a[i])
  elif li_a[i] == li_b[i]:
    ans += li_a[i]
  elif li_a[i] > li_b[i]:
    ans += li_b[i]
print(ans)

Measured memory_bytes: 18752
a = input()
if a == 'SUN':
  print(7)
elif a == 'MON':
  print(6)
elif a=='TUE':
  print(5)
elif a=='WED':
  print(4)
elif a=='THU':
  print(3)
elif a=='FRI':
  print(2)
elif a=='SAT':
  print(1)

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

#define int long long int
#define pb push_back

#define MAXX 100005


int power(int a,int n, int MOD = 1e9)
{

    int res = 1;
    while(n)
    {
        if(n&1)
        {
            n--;
            res = ((res)*(a));
        }
        else
        {
            n/=2;
            a = ((a)*(a));
        }
    }
    return (res);
}

int gcd(int a,int b)
{
    if(b == 0)
        return a;
    return gcd(b,a%b);
}
void solve(void)
{
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1 ; i <= n ; i++)
    {
        int temp = 0;
        for(int j = 1 ; j <= n ; j++)
        {
            if(i*j < n)
            {
                temp = 1;
                ans++;
            }
            else break;
        }
        if(!temp)
            break;
    }
    cout << ans;
    return;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    //cin >> T;
    while(T--)
        solve();

    return 0;
}








Measured memory_bytes: 3648
/* Coached by rainboy */
#include <stdio.h>

#define N 2000
#define M 2000

int main() {
	static char cc[N][M + 1];
	static int ll[N][M], rr[N][M], uu[N][M], dd[N][M];
	int n, m, i, j, x, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
		scanf("%s", cc[i]);
	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
			if (cc[i][j] == '.')
				ll[i][j] = rr[i][j] = uu[i][j] = dd[i][j] = 1;
	for (i = 0; i < n; i++) {
		for (j = 1; j < m; j++)
			if (cc[i][j] == '.')
				ll[i][j] += ll[i][j - 1];
		for (j = m - 2; j >= 0; j--)
			if (cc[i][j] == '.')
				rr[i][j] += rr[i][j + 1];
	}
	for (j = 0; j < m; j++) {
		for (i = 1; i < n; i++)
			if (cc[i][j] == '.')
				uu[i][j] += uu[i - 1][j];
		for (i = n - 2; i >= 0; i--)
			if (cc[i][j] == '.')
				dd[i][j] += dd[i + 1][j];
	}
	ans = 0;
	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
			if (cc[i][j] == '.') {
				x = ll[i][j] + rr[i][j] + uu[i][j] + dd[i][j] - 3;
				if (ans < x)
					ans = x;
			}
	printf("%d\n", ans);
	return 0;
}


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

int main(void){
    int n, k;
    cin >> n >> k;
    double ans = 0;
    for(int i=1; i<=n; i++) {
        int tensu = i;
        int count = 0;
        // コインを振る回数
        while(tensu<=k-1) {
            tensu *= 2;
            count++;
        }
        // cout << count << endl;
        ll coin = 1;
        rep(j,count) {
            coin *= 2;
        }
        coin*=n;
        // cout << coin << endl;
        ans += (1.0/coin);
    }
    //ans /= n;
    printf("%.12lf\n",ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 200 + 10, E = 10 * N * N, INF = 0x3f3f3f3f;

class {
  int adj[N], to[E], next[E], cap[E], cnt;
  int h[N], gap[N], s, t;
  int dfs(int a, int df) {
    if (a == t) return df;
    int res = 0;
    for (int i = adj[a]; i; i = next[i]) {
      int b = to[i];
      if (cap[i] && h[a] == h[b] + 1) {
        int f = dfs(b, std::min(df - res, cap[i]));
        cap[i] -= f;
        cap[i ^ 1] += f;
        res += f;
      }
      if (res == df) return res;
    }
    if (--gap[h[a]] == 0) h[s] = t + 1;
    ++gap[++h[a]];
    return res;
  }
 public:
  inline void clear(int _s, int _t) {
    cnt = 2, s = _s, t = _t;
    memset(adj, 0, sizeof adj);
  }
  inline void link(int a, int b, int c) {
    to[cnt] = b, next[cnt] = adj[a], cap[cnt] = c, adj[a] = cnt++;
    to[cnt] = a, next[cnt] = adj[b], cap[cnt] = 0, adj[b] = cnt++;
  }
  int flow() {
    memset(h, 0, sizeof h);
    memset(gap, 0, sizeof gap);
    int res = 0;
    while (h[s] < t + 1) res += dfs(s, INF);
    return res;
  }
} g;

int n, m;
char a[N][N];

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf(" %s", a[i] + 1);
  int s = n + m + 1, t = s + 1;
  g.clear(s, t);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] == '.') continue;
      g.link(i, j + n, 1);
      g.link(j + n, i, 1);
      if (a[i][j] == 'S') g.link(s, i, E), g.link(s, j + n, E); else if (a[i][j] == 'T') g.link(i, t, E), g.link(j + n, t, E);
    }
  }
  int ans = g.flow();
  printf("%d\n", ans < E ? ans : -1);
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main(void) {
    int d, s;
    while (1) {
        cin >> d;
        if (cin.eof()) break;
        s = 0;
        for (int x = d; x < 600; x += d) s += d * x * x;
        cout << s << endl;
    }
    return 0;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol n; cin >> n;
    lol k; cin >> k;
    lol dev = n/k;
    if(abs((n-dev*k)-k) >= (n-dev*k))
        result = (n-dev*k);
    else
    {
        result = abs((n-dev*k)-k);
    }
    
    

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll x;
    cin >> x;
    ll y = x;
    ll k = 1;
    while(y % 360 != 0){
        k++;
        y += x;
    }
    cout << k << endl;
    return 0;
}


Measured memory_bytes: 3604
//Compiler optimization
#pragma GCC optimize("Ofast")

//include
#include <bits/stdc++.h>
using namespace std;

//typedef
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vl> mat;

//macro
#define reverse(a) reverse(a.begin(),a.end())
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define each(x, v) for (auto &x : v)

//abbreviation
#define pb push_back
#define elif else if
#define mp make_pair
#define endl '\n'

//debug
#define debug(x) cerr << #x << ": " << x << endl
#define v_debug(v) cerr << #v << endl;fr(i,v.size()) cerr << i << ": " << v[i] << endl

//const
const  ll INF = 1e18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(20);
    int n;cin >> n;
    cout << n+n*n+n*n*n << endl;

}

Measured memory_bytes: 3628