akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long ll;
ll n;
struct P {
	ll slip, place;
};
P a[152][10];
ll dp[152][10][1000];
ll siz[152];
ll solve(ll i, ll j,ll m) {
	if (i == n) return 0;
	ll sum = 80000000000000000;
	for (ll z = 0; z < siz[i+1]; z++) {
		ll res = (a[i + 1][z].place - a[i][j].place);
		res = max(res, 0 - res);
		res *= (a[i + 1][z].slip + a[i][j].slip);
		if (dp[i + 1][z][m] != -1) {
			sum = min(sum, res + dp[i + 1][z][m]);
		}
		else {
			sum = min(sum, res + (dp[i + 1][z][m] =
				solve(i + 1, z, m)));
		}
	}
	if (m > 0&&i+2<=n) {
		for (ll z = 0; z < siz[i+2]; z++) {
			ll res = (a[i + 2][z].place - a[i][j].place);
			res = max(res, 0 - res);
			res *= (a[i + 2][z].slip + a[i][j].slip);
			if (dp[i + 2][z][m-1] != -1) {
				sum = min(sum, res + dp[i + 2][z][m-1]);
			}
			else {
				sum = min(sum, res + (dp[i + 2][z][m-1] = 
					solve(i + 2, z, m-1)));
			}
		}
	}
	else if (m > 0 && i + 2 == n + 1) {
		sum = 0;
	}
	return sum;
}
int main() {
	ll m;
	while (cin >> n >> m&&(n!=0||m!=0)) {
		for (ll i = 1; i <= n; i++) {
			ll k;
			cin >> k;
			siz[i] = k;
			for (ll j = 0; j < k; j++) {
				cin >> a[i][j].place >> a[i][j].slip;
				for (ll z = 0; z <= m; z++)
					dp[i][j][z] = -1;
			}
		}
		ll sum = 80000000000000;
		for (ll i = 0; i < siz[1]; i++) {
			sum = min(sum, solve(1, i, m));
		}
		if (m > 0 && 2 <= n) {
			for (ll i = 0; i < siz[2]; i++) {
				if (dp[2][i][m - 1] != -1)
					sum = min(sum, dp[2][i][m - 1]);
				else
					sum = min(sum, dp[2][i][m - 1] = solve(2, i, m - 1));
			}
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 9976
N, A, B, C = gets.split.map(&:to_i)
l_list = N.times.map { gets.to_i }

MAX = 1 << 60

def dfs(l_list, a = 0, b = 0, c = 0, mp = 0, i = 0)
  if i == N
    return MAX if a == 0 || b == 0 || c == 0
    return mp + (A - a).abs + (B - b).abs + (C - c).abs
  end
  [
    dfs(l_list, a + l_list[i], b, c, a == 0 ? mp : mp + 10, i + 1),
    dfs(l_list, a, b + l_list[i], c, b == 0 ? mp : mp + 10, i + 1),
    dfs(l_list, a, b, c + l_list[i], c == 0 ? mp : mp + 10, i + 1),
    dfs(l_list, a, b, c, mp, i + 1)
  ].min
end
ans = dfs(l_list)
puts ans


Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000007

using namespace std;

inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

ll n;

int main()
{
    cin >> n;
    int z=0;
    for(ll i=2;i*i<=n;i++)
    {
        int p=0;
        while(n%i==0)
        {
            n=n/i;
            p++;
        }
        for(int i=1;p>=i;i++)
        {
            z++;
            p=p-i;
        }
    }
    if(n!=1)
    {
        z++;
    }
    cout << z << endl;
    return 0;
}

//99899999999999001


Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x/GCD(x,y)*y;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{

int N;
cin>>N;

vector<int> H(N);

rep(i,N) cin>>H[i];

int a=H[0];

int k=1;

for(int i=1;i<N;++i){
if(H[i]>=a){++k;}
a=max(a,H[i]);
}

cout<<k<<endl;

}

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


int main()
{
    
    int n;
    cin >> n;
    vector<int> a;
    rep(i, n){ int tmp; cin >> tmp; a.push_back(tmp);}
    sort(a.begin(), a.end(), greater<int>());

    double ans = 0;
    double tmp_div = 2.0;
    rep(i, n){
        ans += (double)a[i] / tmp_div;
        if (i != n-2) tmp_div *= 2.0;
    }
    cout << ans << endl;
}



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

int bubbleSort(int A[], int N){

    int sw = 0;
    for(int i = 0; i < N; i++){
        for(int j = N-1; j > i; j--){
            if(A[j] < A[j-1]){
                swap(A[j],A[j-1]);
                sw++;
            }
        }
    }
    return sw;
}

int main(){

    int A[100],N,sw;
    cin >> N;
    for(int i =0; i < N; i++) cin >> A[i];

    sw = bubbleSort(A,N);

    for(int i=0; i < N; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;

    return 0;
}


Measured memory_bytes: 3092
N,M=map(int,input().split())

a,b=1,N//2
c,d=N//2+1,N
if N%2==0:
    a+=1
i=0
while i<M:
    if i<M:
        print(c,d)
        i+=1        
        c,d=c+1,d-1
    else:
        break
    if i<M:
        print(a,b)
        a,b=a+1,b-1
        i+=1
    else:
        break


Measured memory_bytes: 9100
n = int(input())
lst = []
for _ in range(n):
    x, l = map(int, input().split())
    lst.append([x-l, x+l])

lst.sort(key=lambda x:x[1])

ans = 0
st = lst[0][0]
for _ in lst:
    if st <= _[0]:
        st = _[1]
        ans += 1
print(ans)

Measured memory_bytes: 21412
require 'matrix'
include Math
R = 6378.1
loop do
    a, b, c, d = gets.split.map &:to_f
    break if [a, b, c, d].all?{|x| x == -1}
    ta, tb, tc, td = [a, b, c, d].map{|r| PI * r / 180}

    x1 = R * cos(ta)
    y1 = 0 
    z1 = R * sin(ta)
    x1, y1 = x1 * cos(tb) - y1 * sin(tb), x1 * sin(tb) + y1 * cos(tb)
    v1 = Vector[x1, y1, z1] 
    
    x2 = R * cos(tc)
    y2 = 0 
    z2 = R * sin(tc)
    x2, y2 = x2 * cos(td) - y2 * sin(td), x2 * sin(td) + y2 * cos(td)
    v2 = Vector[x2, y2, z2] 
    
    p (R * acos(v1.inner_product(v2) / (v1.r * v2.r))).round
end

Measured memory_bytes: 9436
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AthleteProgramming
{
    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            double a = 100;
            while (n-- > 0) a = Math.Ceiling(a * 1.05);
            Console.WriteLine((int)a * 1000);
        }

    }
}

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

int main(){

  string str;
  int len;

  getline(cin, str);

  len = str.length() - 4;
  for(int i=0; i<len; i++){
    if(str[i] == 'a'){
      if(str[i+1] == 'p' && str[i+2] == 'p' && str[i+3] == 'l' && str[i+4] == 'e'){
        str.replace(i, 5, "peach");
      }
    }
    else if(str[i] == 'p'){
      if(str[i+1] == 'e' && str[i+2] == 'a' && str[i+3] == 'c' && str[i+4] == 'h'){
        str.replace(i, 5, "apple");
      }
    }
  }

  cout << str << endl;

  return 0;

}

Measured memory_bytes: 1180
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CRectangleCutting solver = new CRectangleCutting();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRectangleCutting {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int w = s.nextInt();
            int h = s.nextInt();
            int x = s.nextInt();
            int y = s.nextInt();

            int possible = 0;
            if (w % 2 == 0 && h % 2 == 0) {
                if (x == w / 2 && y == h / 2) {
                    possible = 1;
                }
            }

            double area = w * 1.0 * h;
            out.println(area / 2 + " " + possible);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21972
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
  Scanner sc = new Scanner(System.in);
  int n = 3;
  int[] arr = new int[n];
  for (int i = 0; i < n; i++) {
    arr[i] = sc.nextInt();
  }
  Arrays.sort(arr);
  System.out.println(arr[0]+arr[1]);
  }
}


Measured memory_bytes: 23636
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

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

int main(){
	int n;
	scanf("%d", &n);
	ll x[n], y[n];
	REP(i, 0, n) scanf("%ld %ld", &x[i], &y[i]);

	ll amin = 1e18, amax = 1;
	ll bmin = 1e18, bmax = 1;
	ll cmin = 1e18, cmax = 1;
	ll dmin = 1e18, dmax = 1;
	REP(i, 0, n){
		ll a = x[i] + y[i];
		amin = std::min(amin, a);
		amax = std::max(amax, a);
		ll b = INF-x[i] + y[i];
		bmin = std::min(bmin, b);
		bmax = std::max(bmax, b);
		ll c = INF-x[i] + INF-y[i];
		cmin = std::min(cmin, c);
		cmax = std::max(cmax, c);
		ll d = x[i] + INF-y[i];
		dmin = std::min(dmin, d);
		dmax = std::max(dmax, d);
	}
	ll A = amax-amin, B = bmax-bmin, C = cmax-cmin, D = dmax-dmin;
	printf("%ld\n", std::max({A, B, C, D}));
	return 0;
}



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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll N = 1e6 + 10;

vl G[N];

map<pair<ll, ll>, ll> mp;

ll n, m, H[N], Cnt[N];

bitset<N> mark;

void DFS(ll v, ll p = 0, ll h = 0){
	mark[v] = 1;
	H[v] = h; 
	for (auto u:G[v]){
		if (!mark[u]){
			DFS(u, v, h + 1);
		}else{
			if (H[v] - 1 > H[u]) Cnt[v] ++, mp[{v, u}] = 1;
		}
	}
	if (Cnt[v] % 2 == 0 && p != 0){
		Cnt[p] ++;
		mp[{p, v}] = 1;
	}else if(Cnt[v] % 2 == 1){
		Cnt[v] ++;
		mp[{v, p}] = 1;
	}
	return;
}

int main(){
	cin >> n >> m;
	if (m % 2 == 1) return cout << -1, 0;
	for (int i = 0; i < m; i++){
		ll v, u;
		cin >> v >> u;
		G[v].pb(u), G[u].pb(v);
	}
	DFS(1);
	for (auto u:mp) cout << u.F.F << ' ' << u.F.S << '\n';




	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

const int maxN = 150010;
const int MAXM = 310;
const int MAXK = 17;
const int MOD = 1000000007;
const ll INF = 10000000000000000LL;
const ll inf = 5000000000000LL;

char s[maxN];

int a[maxN];
int main()
{
    scanf("%s",s+1);
    int n = strlen(s+1);
 	int t1 = 0,t2 = 0;
	for(int i=1;i<=n;i++)
	{
		if(s[i] == '0')
			t1++;
		else
			t2++;	
	}
	int cnt = min(t1,t2)*2;
	cout<<cnt<<endl;
    return 0;
}

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

int main(void){
    register int i;
    int n;
    scanf("%d",&n);
    long abc[3];
    for(i = 0;i < 3;i++)scanf("%ld",&abc[i]);
    char s[n][3];
    for(i = 0;i < n;i++)scanf("%s",s[i]);
    char ans[n];
    int i0,i1,i0_ = 0,i1_ = 1;
    for(i = 0;i < n;i++){
        if(!strcmp("AB",s[i])){i0 = 0;i1 = 1;}
        else if(!strcmp("AC",s[i])){i0 = 0;i1 = 2;}
        else{i0 = 1;i1 = 2;}

        if(!abc[i0] && !abc[i1]){
            puts("No");
            return 0;
        }
        
        if(!abc[i0] || !abc[i1]){
            if(!abc[i0]){
                abc[i0]++; abc[i1]--;
                ans[i] = 'A' + i0;
            }else{
                abc[i0]--; abc[i1]++;
                ans[i] = 'A' + i1;
            }
            continue;
        }
        if(i == n-1)goto skip;
        if(!strcmp("AB",s[i+1])){i0_ = 0;i1_ = 1;}
        else if(!strcmp("AC",s[i+1])){i0_ = 0;i1_ = 2;}
        else{i0_ = 1;i1_ = 2;}
        skip:
        if(i0 == i0_ || i0 == i1_){
            abc[i0]++; abc[i1]--;
            ans[i] = 'A' + i0;
        }else{
            abc[i0]--; abc[i1]++;
            ans[i] = 'A' + i1;
        }
    }
    puts("Yes");
    for(i = 0;i < n;i++)printf("%c\n",ans[i]);
}


Measured memory_bytes: 2080
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int n, k; 
	long long h[100100], mn = 1000010000;
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> h[i];
	sort(h, h + n);
	for (int i = 0; i < n - k + 1; i++) {
		if (mn > abs(h[i] - h[i + k - 1])) mn = abs(h[i] - h[i + k - 1]);
	}
	cout << mn << endl;
	return 0;
}

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define MIN(x) *min_element(all(x))
#define MAX(x) *max_element(all(x))
#define in(x) cin >> x
#define co(x) cout << x
#define el  cout << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
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 main() {
    LL n, x, ans;
    cin >> n >> x;
    if(n * 500 >= x)
    cout << "Yes" << endl;
    else
        cout << "No" << endl;


    return 0;
}


Measured memory_bytes: 256
import bisect,sys 
input=sys.stdin.readline 
a,b,Q=map(int,input().split())
INF=10**18
s=[-INF]+[int(input()) for _ in range(a)]+[INF]
t=[-INF]+[int(input()) for _ in range(b)]+[INF]
for q in range(Q):
    x=int(input())
    b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    res=INF 
    for S in [s[b-1],s[b]]:
        for T in [t[d-1],t[d]]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
    print(res)

Measured memory_bytes: 12816
k=int(input())
n='7'
cnt=1
if k%2==0 or k%5==0:
  print(-1)
  exit()
while True:
  if int(n)%k!=0:
    n=int(n)%k
    n=str(n)+'7'
    cnt+=1
  else:
    print(cnt)
    exit()

Measured memory_bytes: 9172
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int N; cin >> N;
	vector<ll> A(N);
	rep(i,N) cin >> A[i];

	ll val = 2;
	ll ans = 0;
	ans += (A[0]-1);
	for (int i = 1; i < N; i++) {
		if (A[i] == val) val++;
		else ans += (A[i]-1LL)/val;
	}

	cout << ans << endl;
}

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

namespace my {
/*汎用*/
template <typename T>
void input_vec(vector<T> &a, ll n) {
  assert(a.empty());
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
}
template <typename T>
void input_set(set<T> &a, ll n) {
  assert(a.empty());
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.insert(tmp);
  }
}

char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }

/*整数*/
ll gcd(ll a, ll b) {  // O( log(max(a,b)) )
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * (b / my::gcd(a, b)); }  // O( log(max(a,b)) )
ll modinv(ll n, ll mod) {                               // O( log(max(n,mod)) )
  assert(mod > 0 && my::gcd(n, mod) == 1);
  n %= mod;
  if (n < 0) n += mod;
  ll a = mod, b = n, x = 1, y = 0;
  while (b != 0) {
    ll q = a / b, r = a % b;
    a = b;
    b = r;
    y -= q * x;
    swap(x, y);
  }
  y %= mod;
  if (y < 0) y += mod;
  return y;
}

bool is_prime(ll n) {  // O( sqrt(n) )
  bool flag = true;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
vector<pair<ll, ll>> prime_factorize(ll n) {  // O( sqrt(n) )
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}

/*union find*/
class unionfind {
 private:
  /*根のparの値は「-(その木の要素数)」とする*/
  ll n_;
  vector<ll> par;

  ll root(ll a) {  // O( log(n) )
    if (par.at(a) < 0)
      return a;
    else {
      par.at(a) = root(par.at(a));  //経路圧縮
      return par.at(a);
    }
  }

 public:
  unionfind(ll n) : n_(n), par(n, -1) {}  // O(n)

  void unite(ll a, ll b) {  // O( log(n) )
    assert(0 <= a && a < n_);
    assert(0 <= b && b < n_);
    if (root(a) == root(b))
      return;
    else {
      ll ra = root(a), rb = root(b);
      if (-par.at(ra) < -par.at(rb)) swap(ra, rb);  //サイズによる併合
      par.at(ra) += par.at(rb);
      par.at(rb) = ra;
    }
  }

  bool is_same(ll a, ll b) {  // O( log(n) )
    assert(0 <= a && a < n_);
    assert(0 <= b && b < n_);
    return root(a) == root(b);
  }

  ll size(ll a) {  // O( log(n) )
    assert(0 <= a && a < n_);
    return -par.at(root(a));
  }
};
}  // namespace my
////////////////////////////////////////////////

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int a = 1; a <= n - 1; a++) {
    ans += (n - 1) / a;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    int N;
    cin >> N;
    vector<int> nums(105, -1);
    vector<pair<string, int>> v(N, pair<string, int>());
    rep(i, N) {
        string s;
        int n;
        cin >> s >> n;
        v[i] = {s, n};
        nums[n] = i + 1;
    }

    sort(all(v), [](pair<string, int> a, pair<string, int> b) {
        if (a.first == b.first)
            return a.second > b.second;
        else
            return a.first < b.first;
    });
    rep(i, N) { cout << nums[v[i].second] << endl; }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i = 0; i<n; i++) cin>>a[i],--a[i];
	ll ans = 0;
	ll g = 0,h= n,vis[n]={0};
	vis[g]++;
	while(h--)
	{
		g = a[g];
		if(vis[g]) break;
		vis[g]++;
	}
	int u = count(vis,vis+n,1);
	int f = 1;
	memset(vis,0,sizeof(vis));
	vis[g]++;
	while(true)
	{
		g = a[g];
		if(vis[g]) break;
		vis[g]++;
		f++;
	}
	ll k2 = k-(u-f);
	if(k<=(ll)(1e7))
	{
		g = 0;
		while(k--)
			g = a[g];
		cout<<g+1<<endl;
		return 0;
	}
	if(f!=0)
		k2 %= (f);
	else k2 = 0;
	while(k2--)
		g = a[g];
	cout<<g+1<<endl;
	return 0;
}

Measured memory_bytes: 6784
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long A, B, C;
    scan(A, B, C);
    writeln(C - min(A - B, C));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define ll long long
#define endl '\n'
#define vi vector<int>
#define rep(i, n) for (i = 0; i < n; i++)
#define rep1(i, n) for (i = 1; i <=n; i++)
#define rep2(i, n) for (i = 0; i < n-1; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend() //Sort in reverse,Vector.
#define present(v,x) (v.find(x)!=v.end()) //set/map etc.


int main()
{  ios_base::sync_with_stdio(false);cin.tie(NULL);
   #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   int n;
  
   cin>>n;
   
   string s;
    cin >> s;
    int i = 0;
    int j = n - 1;
    int cnt = 0;

    while (i < n && j >= 0 && i < j)
     {
      while (i < n && s[i] == 'R') 
      {
        ++i;
      }
      while (j >= 0 && s[j] == 'W') 
      {
        --j;
      }
      if (i < n && j >= 0 && i < j) 
      {
        swap(s[i], s[j]);
        cnt++;
      }
      
    }
    cout << cnt << endl;
}
   



   




Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
#define mx 1000000000000000000
#define ll long long int
//ll a[40001000];
//ll number[20],used[20];
#define guestroom int main()
#define ovinondonvai cout
#define salamvai cin
#define chata for(ll i=0;i<n;i++)
#define  joybangla return 0
guestroom{
  string s,t;
  salamvai>> s;
  t=s.substr(0,3);
  ovinondonvai << t << endl;
  joybangla;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n, k, r, s, p;
    cin >> n >> k >> r >> s >> p;
    string t;
    cin >> t;
    ll ans = 0;
    rep(i, n) {
        if(t[i] == 'r') ans += p;
        else if(t[i] == 's') ans += r;
        else ans += s; 
    }
    rep(i, n - k) {
        if(t[i] == t[i + k]) {
            if(t[i] == 'r') ans -= p;
            else if(t[i] == 's') ans -= r;
            else if(t[i] == 'p') ans -= s; 
            t[i + k] = '#';
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
n,*h=map(int,open(0).read().split());d=[0]*n;d[1]=abs(h[1]-h[0])
for i in range(2,n):
  d[i]=min(d[i-1]+abs(h[i]-h[i-1]),d[i-2]+abs(h[i]-h[i-2]))
print(d[-1])

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

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 ** 18
MOD = 10 ** 9 + 7

S = input()
N = len(S)
X, Y = MAP()

# ランレングス圧縮
A1, A2 = [], []
cnt = d = 0
for s in S:
    if s == 'T':
        if d == 0:
            A1.append(cnt)
        else:
            A2.append(cnt)
        cnt = 0
        d ^= 1
    else:
        cnt += 1
if d == 0:
    A1.append(cnt)
else:
    A2.append(cnt)
# 最初だけ右固定なので別処理
X -= A1[0]
A1.pop(0)

# 縦横独立に、到達可の場所を確認する
M1 = len(A1)
M2 = len(A2)
# 集合管理をbitset高速化
dpx = [0] * (M1+1)
dpy = [0] * (M2+1)
# 負数を考慮してずらしてから始める
offset = 20000
dpx[0] = 1 << offset
dpy[0] = 1 << offset
for i, a in enumerate(A1):
    dpx[i+1] |= dpx[i] << a
    dpx[i+1] |= dpx[i] >> a
for i, a in enumerate(A2):
    dpy[i+1] |= dpy[i] << a
    dpy[i+1] |= dpy[i] >> a

if dpx[M1] & 1<<(X + offset) and dpy[M2] & 1<<(Y + offset):
    Yes()
else:
    No()


Measured memory_bytes: 24308
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/
ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

ll lcm(ll number1,ll number2){
	return number1 * number2 / gcd(number1,number2);	
}

int main() {
	
	ll a;
	scanf("%lld", &a);
	ll ans;
	if(a % 2 == 0){
	  ll i = 10;
	  while(a / i != 0){
	    ans += a / i;
	    i *= 5;
}
	  printf("%lld\n", ans);
}
	else printf("%lld\n", 0LL);
	
	Please AC;
}


Measured memory_bytes: 888
def prime_factorize(n):
    '''
    素因数分解のリストを返す。n == 1のとき[]になるので注意。
    :param n:int
    素因数分解する自然数
    :return: list
    素因数分解した結果。

    例
    n : 10
    primes : [[2, 1], [5, 1]]
    '''
    primes = []
    for i in range(2, int(n ** (1 / 2)) + 1):
        if n % i != 0:
            continue
        num = 0
        while n % i == 0:
            num += 1
            n //= i
        primes.append([i, num])
    if n != 1:
        primes.append([n, 1])
    return primes

N = int(input())
prime_list = prime_factorize(N)
ans = 0
for _, e in prime_list:
    now = 1
    work = e
    while work >= now:
        work -= now
        now += 1
        ans += 1
print(ans)

Measured memory_bytes: 9464
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {
	ll N, M;
	cin >> N >> M;
	vector<ll> t(N);
	rep(i, M*2) {
		ll a;
		cin >> a;
		t.at(a - 1)++;
	}
	rep(i, N) {
		cout << t.at(i) << endl;
	}
	
	
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const ll INF = 1ll << 60;

int main(){
	ll n, x, d; cin >> n >> x >> d;
	if(d == 0){
		if(x == 0) {
			cout << 1 << endl;
			return 0;
		} else {
			cout << n+1 << endl;
			return 0;
		}
	}
	map<int, vector<pl>> mp;
	rep(i,n+1){
		ll s = x*i;
		ll l = (ll) i*(i-1)/2;
		ll r = l + (ll) i* (n-i);
		s += l*d;
		r -= l;
		mp[(s%d+d)%d].emplace_back(s,r);
	}

	ll ans = 0;
	for (auto p : mp){
		auto a = p.second;
		int m = a.size();
		rep(i,m) a[i].first = (a[i].first - p.first)/d;
		vector<pl> ev;
		rep(i,m) {
			ev.emplace_back(a[i].first, 1);
			ev.emplace_back(a[i].first+a[i].second+1, -1);
		}
		sort(all(ev));
		ll cnt = 0, pre = -INF;
		for (auto e : ev){
			ll len = e.first - pre;
			if(cnt) ans += len;
			cnt += e.second;
			pre = e.first;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 24192
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.
	int N;
	cin >> N;
	VI d(100 + 1, 0);
	FOR(i, 0, N) {
		int a;
		cin >> a;
		d[a] = 1;
	}
	int count = 0;
	FOR(i, 0, 101) {
		if (d[i] != 0) {
			count++;
		}
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
DD = []
for i in range(N):
    DD.append(list(map(int,input().split())))
# print('DD:',DD)

cnt=0
flg=0
for i in range(N):
    if cnt==3:
        flg=1
        break
    elif DD[i][0]==DD[i][1]:
        cnt+=1
    else:
        cnt=0

if cnt==3:
    flg=1

if flg==1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 62364
k, n = map(int, input().split())
a = input().split()
l_si_i = [int(s) for s in a]
#print(l_si_i)

num_list = []
for i in range(n):
  if i == 0:
    sub = l_si_i[0] + (k - l_si_i[n-1])
  else:
    sub = l_si_i[i] - l_si_i[i-1]
  
  num_list.append(sub)
  
#print(num_list)
#print(sum(num_list))

idx = num_list.index(max(num_list))
#print(idx)
num_list.pop(idx)
print(sum(num_list))


Measured memory_bytes: 27980
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}


int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{
	

string s;
cin>>s;
set<char> ss;
multiset<char> ms;
for(int i=0;i<s.length();i++)
{
	ss.insert(s[i]);
	ms.insert(s[i]);
}

if(ss.size()!=2)
cout<<"No";

else
{
char x=*(ss.begin());
if(ms.count(x)!=2)
cout<<"No";
else
cout<<"Yes";
	
}
	
	
	
	
	
	
	


}return 0;}

Measured memory_bytes: 256
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
	long double a, b;
	cin >> a >> b;
	cout << (int) (a * b);
}

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


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector <int> A;
	int ans = 1;
	for (int i = 0; i < n; ++i)
	{
		int x;
		cin>>x;
		if(A.size() <= 1)
			A.push_back(x);
		else
		{
			if(A[0] <= A.back() && A.back() <= x)
				A.push_back(x);
			else if(A[0] >= A.back() && A.back() >= x)
				A.push_back(x);
			else
			{
				ans++;
				A.clear();
				A.push_back(x);
			}
		}
	}
	cout<<ans<<"\n";
	return 0;
}

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

def Main(N, W, V):
    dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
    for i in range(N):
        for j in range(W+1):
            if(j < V[i][0]):
                dp[i+1][j] = dp[i][j]
            else:
                dp[i+1][j] = max(dp[i][j], dp[i][j-V[i][0]]+V[i][1])
    return dp[N][W]            

def main():
    N, W = map(int, input().split())
    V = []
    for _ in range(N):
        V.append(list(map(int, input().split())))
    print(Main(N, W, V))

if __name__ == '__main__':
    main()

Measured memory_bytes: 171400
#include <bits/stdc++.h>
 
using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    string s,t;
    cin>>s>>t;
    for(int j=0;j<s.size();j++){
       int cnt=0;
        for(int i=0;i<s.size();i++){
            if(s[i]==t[i]){
                cnt++;
            }
            if(cnt==s.size()){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
         string tmp(s);
         char c=s[s.size()-1];
         for(int k=0;k<s.size()-1;k++){
             s[k+1]=tmp[k];
         }
         s[0]=c;
         
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    //#define int long long
    typedef long long ll;
    #define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
    #define forn(i, n) fore(i, 0, n)
    #define fori(i, l, r) fore(i, l, (r) + 1)
    #define sz(v) int((v).size())
    #define all(v) (v).begin(), (v).end()
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
    using namespace std; 
     
    const double PI = atan(1)*4;

    int dx[8]={1,0,-1,0,1,-1,-1,1};
    int dy[8]={0,1,0,-1,1,1,-1,-1};
     
     
    bool isprime(int n)
    {
        for(int i=2;i*i<=n;i++)
            if(n%i==0)
                return false;
        return true;
    }
     
    bool comp(pair<int,int> a, pair<int,int> b)
    {
        return b.ff < a.ff ;
    }
     
    int modpow(int b,int p,int m)
    {
        if(p==0) return 1%m;
        if(p%2) return (b*modpow(b,p-1,m))%m;
        int u=modpow(b,p/2,m);
        return (u*u)%m;
    }
     
    int fn(int x,int y,int z)
    {
        int ans=((x-y)*(x-y) + (y-z)*(y-z) + (z-x)*(z-x) );
        //cout<<x<<" "<<y<<" "<<z<<"\n";
        return ans; 
    }
     
    /*void bsearch(int max,int min)   //  for function 
    //void bsearch(int a,int n, int x)     // for array
    {
        int k=min;
     
        //  for array
     
    /*    for(int b=n/2; b>=1; b/=2)
        {
            while(k+b<n && arr[k+b]<=x) k+=b; 
        }
     
        if(arr[k]==x)
            cout<<"found at "<<k+1;
        else
            cout<<"not found";
    */
     
        //  for function 
     
    /*    for(int b=max; b>=1; b/=2)
        {
            while( !fn(b+k) ) k+=b;
        }
        cout<<k+1;
     
    }*/
     
     
    int main()
    {
     
       
     
        int t=1;
        //cin>>t;
     
        while(t--)
        {
            int o,z,mm,k;
            cin>>o>>z>>mm>>k;

            int sum=min(o,k);
            k-=min(o,k);

            k-=min(z,k);

            sum-=min(mm,k);
            k-=min(mm,k);

            cout<<sum;
        }
        return 0;
    }

Measured memory_bytes: 3632
#include<stdio.h>
main(){
  char tmp[110][110];
  int a,b,i,j,flg[110][110],x,y;
    scanf("%d %d",&a,&b);
    if(a==0&&b==0)return 0;
    for(i=0;i<a;i++)for(j=0;j<b;j++)flg[i][j]=0;
    for(i=0;i<a;i++)scanf("%s",tmp[i]);

    x=y=0;
    while(1){
      switch(tmp[x][y]){
      case'>':y++;break;
      case'<':y--;break;
      case'^':x--;break;
      case'v':x++;break;
      default:printf("%d %d\n",y,x);return main();
      }
      if(flg[x][y]==1){
	printf("LOOP\n");
	return main();
      }
      flg[x][y]=1;
    }
}

Measured memory_bytes: 1032
def main():
  h, n = map(int, input().split())
  l = [list(map(int, input().split())) for i in range(n)]

  dp = [10 ** 8 + 1 for i in range(h + 10 ** 4 + 1)]
  dp[0] = 0

  for i in range(h):
    if dp[i] == 10 ** 8 + 1:
        continue
    for a, b in l:
      x = dp[i] + b
      if dp[i + a] > x:
        dp[i + a] = x

  print(min(dp[h:]))

main()




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

int x, y, z, k;
long long a[1000], b[1000], c[1000];

int main() {
  cin >> x >> y >> z >> k;
  for (int i = 0; i < x; ++i) cin >> a[i];
  for (int i = 0; i < y; ++i) cin >> b[i];
  for (int i = 0; i < z; ++i) cin >> c[i];
  
  vector<long long> v;
  for (int i = 0; i < x; ++i) for (int j = 0; j < y; ++j) v.push_back(a[i] + b[j]);
  
  sort(v.rbegin(), v.rend());
  sort(c, c+z), reverse(c, c+z);
  
  vector<long long> w;
  for (int i = 0; i < v.size(); ++i) for (int j = 0; j < z; ++j) if ((i+1) * (j+1) <= k) {
    w.push_back(v[i] + c[j]);
  }
  
  sort(w.rbegin(), w.rend());
  
  for (int i = 0; i < k; ++i) cout << w[i] << endl;
}

Measured memory_bytes: 10604
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int H,W,h,w;
int a[510][510];

int main(){
  cin >> H >> W >> h >> w;
  int sum=0;
  if(H%h==0 && W%w==0){
    cout << "No" << endl;
  }else{
    if(H%h!=0){
      rep(i,1,H+1) rep(j,1,W+1){
        if(i%h==1) a[i][j] = 10000;
        if(i%h==0) a[i][j] = -10001;
      }
    }else{
      rep(i,1,H+1) rep(j,1,W+1){
        if(j%w==1) a[i][j] = 10000;
        if(j%w==0) a[i][j] = -10001;
      }
    }
    cout << "Yes" << endl;
    rep(i,1,H+1){
      rep(j,1,W+1){
        if(j!=1)cout << " ";
        cout << a[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 2816
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int f() {
    return 0;
}
 
void main() {
  int N, K;
  scanf("%d", &N);
  scanf("%d", &K);
  int ans = 0;
  for(int i = 0; i < N; i++) {
    int *ptr = (int *)malloc(sizeof(int *));
    scanf("%d ", ptr);
    int tmp = (K - (*ptr));
    int a = (tmp > 0 ? tmp : (-tmp))*2;
    int b = (*ptr)*2;
    ans += (a > b ? b : a);
  }
  printf("%d\n", ans);
  f();
  __asm__("mov $0x0,%rax");
}

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

int main(){
    int i, j, k;
    int N;
    cin >> N;
    vector<long long> H(N), P(N);
    vector<pair<long long, int>> order(N);
    for(i=0; i<N; i++){
        cin >> H[i] >> P[i];
        order[i] = {H[i]+P[i], i};
    }
    sort(order.begin(), order.end());
    long long dp[5001][5001];
    const long long INF = 1e18;
    for(i=0; i<=N; i++){
        dp[i][0] = 0;
        for(j=1; j<=N; j++) dp[i][j] = INF;
    }
    
    for(i=1; i<=N; i++){
        k = order[i-1].second;
        dp[i][0] = 0;
        for(j=1; j<=i; j++){
            dp[i][j] = dp[i-1][j];
            if(dp[i-1][j-1] <= H[k]) dp[i][j] = min(dp[i][j], dp[i-1][j-1] + P[k]);
        }
    }
    for(i=N; i>=0; i--){
        if(dp[N][i] < INF){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 195840