akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	static final int CHECK = 0;
	static final int RINGO = 1;
	static final int KAKI  = 2;
	static final int MIKAN = 3;
	
	int[][] field;
	int h, w, fruit;
	int[] dy = { 1, 0, -1,  0 };
	int[] dx = { 0, 1,  0, -1 };

	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			h = scan.nextInt();
			w = scan.nextInt();
			if (h + w == 0)
				break;
			field = new int[h][];
			for (int i = 0; i < h; i++) {
				field[i] = new int[w];
				char[] f = scan.next().toCharArray();
				for (int j = 0; j < w; j++) {
					if (f[j] == '@')
						field[i][j] = RINGO;
					else if (f[j] == '#')
						field[i][j] = KAKI;
					else
						field[i][j] = MIKAN;
				}
			}
			int ans = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (field[i][j] != CHECK) {
						ans++;
						fruit = field[i][j];
						bfs(i, j);
					}
				}
			}
			System.out.println(ans);
		}
	}

	void bfs(int y, int x) {
		if (y < 0 || x < 0 || y >= h || x >= w || field[y][x] != fruit)
			return;
		field[y][x] = CHECK;

//		???????????¨??????????????????????????¬??????
//		for (int i = 0; i < 4; i++)
//			bfs(y + dy[i], x + dx[i]);

		bfs(y + 0, x + 1);
		bfs(y + 0, x - 1);
		bfs(y + 1, x + 0);
		bfs(y - 1, x + 0);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 28956
#include <stdio.h>
int main(void){
    int n,p,ans=0,max=0;
    scanf("%d",&n);
    for (int i=0; i<n; i++){
        scanf("%d",&p);
        ans+=p;
        max=max>p?max:p;
    }
    printf("%d\n",ans-max/2);
	return 0 ;
}

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

int main() {
  int n, y;
  cin >> n >> y;
  bool b = false;
  int s, t;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; i + j <= n ; j++) {
      int p = 10000 * i + 5000 * j + 1000 * (n - i - j);
      if (p == y) {
        b = true;
        s = i;
        t = j;
        break;
      }
    }
  }
  if (b) cout << s << " " << t << " " << n - s - t << endl;
  else cout << "-1 -1 -1" << endl;
}

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

using namespace std;

int main() {
  int n;
  while (cin >> n) {
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    auto it = unique(v.begin(), v.end());
    int rm = v.end() - it;
    if (rm % 2 == 1) rm++;
    cout << n - rm << endl;
  }
}


Measured memory_bytes: 640
a = input()
alp = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
if a in  alp:
    print('a')
else:
    print('A')

Measured memory_bytes: 9012
n, k = [int(i) for i in input().split(' ')]
a_s = [int(i) - 1 for i in input().split(' ')]

to = 0
to_s = []
m = {}
count = 0
while True:
  count += 1
  m[to] = count
  to_s.append(to)
  #print("#",to)
  #次の町に行く
  to = a_s[to]

  #すでに行ったことがあれば抜ける
  if to in m:
    break

#ループに入るまでの工程数
p1 = m[to] - 1
#ループの周期
p2 = count - p1

#print(to_s, m, p1, p2)
if k <= p1:
  ans = to_s[k]
else:
  pos = (k - p1) % p2 + p1
  #print(pos)
  ans = to_s[pos]
#print(ans + 1, p1,  p2)
print(ans + 1)


Measured memory_bytes: 39240
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double menseki = r * r * Math.PI ;
        double enshu = r * 2 * Math.PI;
        System.out.println(String.format("%.6f" +" "+ "%.6f",menseki,enshu));
        sc.close();
    }
}


Measured memory_bytes: 28032
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] m = new int[N];
        for (int i = 0; i < m.length; ++i) {
            m[i] = sc.nextInt();
        }

        System.out.println(solve(m, X));

        sc.close();
    }

    static int solve(int[] m, int X) {
        return m.length + (X - Arrays.stream(m).sum()) / Arrays.stream(m).min().getAsInt();
    }
}

Measured memory_bytes: 28500
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define mod(n) n % 1000000007
#define sp << " "
#define precision(n) cout << fixed << setprecision(n);
#define startTime time_t start, end;time(&start);
#define endTime time(&end);double tt = double(end-start);cout<<"Time taken : "<<fixed<<tt<<setprecision(5);cout <<" sec"<< endl;
 
using namespace std; 

int main() { 
    IOS;
    ll n;
    cin >> n;
    vll h(n);
    vll cost(n, 0);
    for (int i = 0; i < n; i++) {
    	cin >> h[i];
    	if (i > 0) {
    		cost[i] = min(cost[i - 1] + abs(h[i] - h[i - 1]), cost[i - 2] + abs(h[i] - h[i - 2]));
    	}
    }
    cout << cost[n - 1] << endl;
}   

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)

int beki(int a,int b){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=mod(x*a);
		}
		a=mod(a*a);
		b>>=1;
	}
	return x;
}

struct matrix{
	vector<vector<long long>> value;
	
	matrix(int height,int width){
		value.resize(height,vector<long long>(width,0));
		if(height==width){
			for(int i=0;i<get_width();i++){
				value[i][i] = 1;
			}
		}
	}
	
	void resize(int height,int width){
		value.resize(height,vector<long long>(width,0));
		for(int i=0;i<get_width();i++){
			value[i][i] = 1;
		}
	}
	
	void set_value(vector<vector<long long>> &V){
		value = V;
	}
	
	void set_value(initializer_list<long long> list){
		auto it = list.begin();
		for(int i=0;i<get_height();i++){
			for(int j=0;j<get_width();j++){
				value[i][j]=*it;
				if(i!=get_height()-1||j!=get_width()-1)it++;
			}
		}
	}
	
	int get_width(){
		return value[0].size();
	}
	
	int get_height(){
		return value.size();
	}
	
	void print(){
		for(int i=0;i<get_height();i++){
			for(int j=0;j<get_width();j++){
				if(j!=0)cout<<' ';
				cout<<value[i][j];
			}
			cout<<endl;
		}
	}
	
};

matrix matrix_multiple(matrix &A,matrix &B){

	matrix R(A.get_height(),B.get_width());
	int multi_cnt;
	if(A.get_width()!=B.get_height()){
		assert(false);
	}
	else multi_cnt = A.get_width();
	
	for(int i=0;i<R.get_height();i++){
		for(int j=0;j<R.get_width();j++){
			R.value[i][j]=0;
			for(int k=0;k<multi_cnt;k++){
				
				R.value[i][j] = mod(R.value[i][j] + mod(A.value[i][k] * B.value[k][j]));
	
			}
		}
	}
	return R;
	
}

matrix matrix_beki(matrix A,long long cnt){
	if(A.get_width()!=A.get_height())assert(0);
	matrix R(A.get_width(),A.get_width());
	while(cnt!=0){
		if(cnt&1){
			R=matrix_multiple(R,A);
		}
		A=matrix_multiple(A,A);
		cnt>>=1;
	}
	return R;
}

int main(){
	
	long long N,K;
	cin>>N>>K;
	
	vector<vector<long long>> E(N,vector<long long>(N));
	
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			cin>>E[i][j];
		}
	}
	
	matrix m(N,N);
	m.set_value(E);

	m = matrix_beki(m,K);
	
	
	vector<vector<long long>> A(N,vector<long long>(1,1));
	matrix ans(N,1);
	ans.set_value(A);
	ans = matrix_multiple(m,ans);
	
	
	int pri = 0;
	for(int i=0;i<N;i++){
		pri = mod(pri + ans.value[i][0]);
	}
	
	cout<<pri<<endl;
	
	
	return 0;
}


Measured memory_bytes: 512
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>

#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e8
#define EPS 1e-10
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

int n, m, s, g1, g2;
int E[101][101];
int dp[101][101];
int main(){
  while(cin >> n >> m >> s >> g1 >> g2, n){
    s--; g1--; g2--;
    rep(i, n) rep(j, n) E[i][j] = INF;
    rep(i, m){
      int b1, b2, c;
      cin >> b1 >> b2 >> c;
      b1--; b2--;
      E[b1][b2] = c;
    }
    //rep(i, n) rep(j, n) dp[i][j] = INF;
    rep(i, n) rep(j, n) dp[i][j] = E[i][j];
    rep(i, n) dp[i][i] = 0;
    bool changed = true;
    while(changed){
      changed = false;
      rep(k, n){      
	rep(i, n){
	  rep(j, n){
	    if(dp[i][j] > dp[i][k] + dp[k][j]){
	      dp[i][j] = dp[i][k] + dp[k][j];
	      changed = true;
	    }
	  }
	}
      }
    }
    int ans = INF;
    rep(br, n){
      ans = min(ans, dp[s][br] + dp[br][g1] + dp[br][g2]);
    }
    cout << ans << endl;
  }
}

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

namespace CSharpSample01
{


	class Program
	{
		static void Main(string[] args)
		{
			// スペース区切りの整数の入力
			var inputValue = Console.ReadLine().Distinct();

			if(inputValue.Count() == 1)
			{
				Console.WriteLine("No");
			}
			else
			{
				Console.WriteLine("Yes");
			}

		}
	}
}

Measured memory_bytes: 13268
#include <cstdio>
#include <cstring>
#define MAXN 100010
#define LL long long

int n,m;
LL v[MAXN],ans[MAXN],K;
int a[MAXN];
int p[MAXN];
bool visit[MAXN];

void gao(int x){
	static int b[MAXN];
	int numb=0;
	b[numb++]=x;
	visit[x]=1;
	for(int i=a[x];i^x;i=a[i]){
		b[numb++]=i;
		visit[i]=1;
	}
	for(int i=0;i<numb;i++){
		int x=b[i];
		p[x]=b[(K+i)%numb];
	}
}

int main(){
#ifdef DEBUG
	freopen("C.in","r",stdin);
#endif
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",v+i),a[i]=i;
	for(int i=n;i>=2;i--) v[i]-=v[i-1];
	scanf("%d%lld",&m,&K);
	while(m--){
		int t;
		scanf("%d",&t);
		a[t]^=a[t+1]^=a[t]^=a[t+1];
	}
	for(int i=1;i<=n;i++)
		if(!visit[i])
			gao(i);
	for(int i=1;i<=n;i++)
		ans[i]=v[p[i]];
	for(int i=2;i<=n;i++)
		ans[i]+=ans[i-1];
	for(int i=1;i<=n;i++) printf("%.1lf\n",(double)ans[i]);
}


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

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int main() {
    int K;
    cin >> K;
    ll ans = 0;
    for(int a=1; a<K+1; a++){
        for(int b=1; b<K+1; b++){
            for(int c=1; c<K+1; c++){
                ans += gcd(a,gcd(b,c));
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
using namespace std;
constexpr int d[5] = {1, 0, -1, 0, 1};
int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> f(H, vector<char>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> f[i][j];
        }
    }
    bool ok = true;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (f[i][j] == '#') {
                int num = 0;
                for (int di = 0; di < 4; di++) {
                    const int newy = i + d[di];
                    const int newx = j + d[di + 1];
                    if (newy >= 0 and newy < H and newx >= 0 and newx < W and f[newy][newx] == '#') num++;
                }
                if (num == 0) ok = false;
            }
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#define rep(i,n) for( i=0;i<(n);i++)
using namespace std;
using ll=long long;



int main(){
	int a, b, t;

	cin >> a >> b >> t;
	int ans = t / a * b;

	cout << ans;
}

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

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

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (to_string(i).length() % 2 == 1) ans++;
    }

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


Measured memory_bytes: 3728
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]
information.sort(key=lambda x: x[2])

for c_x in range(101):
    for c_y in range(101):
        x, y, h = information[-1]
        H = h + abs(x - c_x) + abs(y - c_y)
        judge = 1
        for w in information[:-1]:
            x, y, h = w
            if h == max(0, H - abs(x - c_x) - abs(y - c_y)):
                continue
            else:
                judge -= 1
                break
        if judge:
            print(c_x, c_y, H)
            sys.exit()
        else:
            continue



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

int main() {
	int a, b;
	cin >> a >> b;
	if (a < b) {
		cout << "a < b" << endl;
	}
	else if (a > b) {
		cout << "a > b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
}


Measured memory_bytes: 3100
/*
	@・ω・@ <だれだろうね
*/

/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<long long>;
using pll = pair<long long, long long>;
template<class T> using pr = pair<T, T>;
template<class T> using vec = vector<T>;

#define debug(x) (std::cerr << (x) << "\n")
#define debug_tab(n, x) (std::cerr << strMulti("\t",n) << (x) << "\n")
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << (h) << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << (h) << " : " <<  (x) << "\n")

#define str(n)	(n.toString())

#define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(ll i=(n)-1; i >= 0; --i)
#define rrep1(i, n) for(ll i=(n); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll MOD = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = math_P(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool cmp_2nd(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T mod_pow(T x, T n, const T& p) { T ret = 1; while (n > 0) { if (n & 1) { (ret *= x) %= p; } (x *= x) %= p; n >>= 1; } return ret; }

/*****/

ll N, M;

void Main()
{
	cin >> N >> M;

	cout << (math_C(N, 2ll) + math_C(M, 2ll));
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);

	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/

	Main();
	cout << endl;

	return 0;
}


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

// a 進法で n の桁和
int func(int n, int a) {
    int res = 0;
    while (n > 0) {
        res += n%a;
        n /= a;
    }
    return res;
}

int main() {
    int N;
    cin >> N;

    int res = N; // INF
    for (int i = 0; i <= N; ++i) {
        int tmp = func(i, 6) + func(N - i, 9);
        res = min(res, tmp);
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  string s;
  int n, k;
  while (cin >> n >> k >> s) {
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;
  }
}


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

int main() {
	int N;
	int M;
	int i;
	int A;
	long long p;


	cin >> N >> M;
	p=0;
	for(i=0;i<M;i++){
		cin >> A;
		p+=A;
	}
	if(p<=N){
		cout << N - p << endl;
	} else {
		cout << -1 << endl;
	}
	return 0;
}


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


n, m = map(int, input().split())
a = [0] * m
dp = [0] * (n + 1)
mod = 10 ** 9 + 7
for i in range(m):
    a[i] = int(input())
a = set(a)
dp[:2] = 1, 1 if 1 not in a else 0

for i in range(2, n + 1):
    if i not in a:
        dp[i] = (dp[i - 1] + dp[i - 2]) % mod
print(dp[-1])


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

int main() {
    int n, m; scanf("%d%d", &n, &m);

    constexpr int kMod = 1'000'000'000 + 7;
    vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
    dp[0][0] = 1;

    for (int i = 0; i < n; ++i) {
        vector<vector<int>> nxt(n + 1, vector<int>(m + 1, 0));
        for (int j = 0; j <= n; ++j) {
            for (int v = 0; v <= m; ++v) {
                if (dp[j][v] == 0) continue;
                if (v + j + j <= m) {
                    (nxt[j][v + j + j] += 1LL * (j + j + 1) * dp[j][v] % kMod) >= kMod ? nxt[j][v + j + j] -= kMod : 0;
                }
                if (j + 1 <= m && v + j + j + 2 <= m) {
                    (nxt[j + 1][v + j + j + 2] += dp[j][v]) >= kMod ? nxt[j + 1][v + j + j + 2] -= kMod : 0;
                }
                if (j > 0 && v + j + j - 2 <= m) {
                    (nxt[j - 1][v + j + j - 2] += 1LL * j * j * dp[j][v] % kMod) >= kMod ? nxt[j - 1][v + j + j - 2] -= kMod : 0;
                }
            }
        }
        dp = nxt;
    }
    printf("%d\n", dp[0][m]);
}


Measured memory_bytes: 1308
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const ll inf = 1e16;
const ll md = 1000000007;

int to753(int a,int d){
  int res=0;
  bool f7=false,f5=false,f3=false;
  int ten=1;
  rep(i,d){
    int r=a%3*2+3;
    res+=r*ten;
    if(r==3) f3=true;
    if(r==5) f5=true;
    if(r==7) f7=true;
    a/=3;
    ten*=10;
  }
  if(f3&&f5&&f7) return res;
  else return -1;
}

int main() {
  int n;
  cin>>n;
  int ans=0;
  int lim=753;
  int s=7000;
  int d=3;
  for(int t=5;d<10;t++){
    int a=to753(t,d);
    if(a==-1) continue;
    if(a>n) break;
    ans++;
    if(a==lim){
      lim=lim+s;
      s*=10;
      t=4;
      d++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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 T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  int n;

  while(cin >> n, n) {
    int s;
    int ice[10] = {0};
    REP(i, n) {
      cin >> s;
      ice[s]++;
    }

    REP(i, 10) {
      if(!ice[i]) cout << '-' << endl;
      else {
	REP(j, ice[i]) cout << '*';
	cout << endl;
      }
    }
  } 
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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 vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  double N, K; cin >> N >> K;
  if(round(N / 2) >= K) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
from collections import deque
N,M=map(int,input().split())
ab=[]
for i in range(M):
    a,b=map(int,input().split())
    ab.append([a,b])

ab.sort(key=lambda x :x[1])
ans=deque()
for i in ab:
    if len(ans)>0:
        if i[0]<ans[-1] :
            continue
    ans.append(i[1])
print(len(ans))

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);


typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


#define MAX (int)1e6 + 10
const ll mod = 1e9 + 7;
const double pi = 2*acos(0.0);
//vector<bool> prime(MAX,true);

//vl graph[MAX];
//vl parent(MAX);
//vector<bool> vis(MAX,0);

int main(int argc, char const *argv[])
{
	int k,n,m,a;
	cin >> n >> m;
	int i,j;
	map<int,int> f;
	forn(0,n,i)
	{
		cin >> k;
		while(k--)
		{
			cin >> a;
			f[a]++;
		}
	}
	int res = 0;
	for(auto x : f)
	{
		res += (x.ss == n);
	}
	cout << res << '\n';
}	



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

int main(){
  string s;
  cin >> s;
  
  int cnt = 0;
  
  for (int i=0; i<3; i++){
    if (s.at(i) == s.at(i+1)) cnt++;
  }
  
  if (cnt >= 1) cout << "Bad" << endl;
  else cout << "Good" << endl;
}

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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N, A, B;
    cin >> N >> A >> B;

    _PR(MIN(A*N,B));

    return 0;
}

/*



*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll n;
    cin >> n;
    ll x[n];
    ll y[n];
    for(ll i = 0; i < n; i++) cin >> x[i];
    for(ll i = 0; i < n; i++) y[i] = x[i];
    sort(x, x + n);
    ll cen = x[n / 2 - 1];
    for(ll i = 0; i < n; i++) cout << x[n / 2 - 1 + (y[i] > cen ? 0 : 1)] << endl;
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=2e5+5;
const int N1=-1e18-5;
int dp[N][3];
int a[N];

int func(int x,int y,int n){
	if(x>=n||y<0) return 0;
	if(dp[x][y]!=N1) return(dp[x][y]);
	int res=N1;
	for(int i=0;i<=y;i++){
		res=max(res,a[x+i]+func(x+i+2,y-i,n)); 
	}
	return(dp[x][y]=res);
}

int32_t main(){
    IOS;
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++){
    	for(int j=0;j<3;j++) dp[i][j]=N1;
    }
	int ans=func(0,n%2+1,n);
	cout<<ans<<endl;
}

Measured memory_bytes: 17712
/*-----input blog start------//
<!-- more -->
//-----input blog end  ------*/
/*!
 * Copyright(c) 2019 Shu_Yan
 * MIT Licensed
 * Luogu: https://www.luogu.org/space/show?uid=44615
 * Github: https://github.com/shuyumo2003/
 * Gitee: https://gitee.com/Shu_Yu_Mo/
 * These words were created by an amazing tool written by Shu_Yu_Mo(Shu_Yan).
 * date: 2020-09-13 20:01:48
 * pid : 
 */
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<ctime>
#define For(x) for(int i = 1;i <= x;i++)
#define _For(x) for(int i = 0;i < x;i++)
#define LL long long
const int MOD = 1e9 + 7;
#define show(x) cerr <<"[" <<  __LINE__ << "] " << #x << " = " << x << endl;
using namespace std;
// const int _ = 1e6 + 10;
inline int read() { char c = getchar(); int sign = 1; int x = 0; while(c > '9' || c < '0') { if(c=='-')sign = -1; c = getchar(); } while(c <= '9' && c >= '0') { x *= 10; x += c - '0'; c = getchar(); } return x * sign; }
//--------------init finish line-------------------

const int _ = 2e3 + 100;
int C[_][_];
int frac[_];
void init(int n = _ - 10){
    C[0][0] = 1;
    for(int i = 1; i <= n; i++){
        C[i][0] = 1;
        for(int j = 1; j <= i; j++){
            C[i][j] = ( C[i - 1][j] +0ll+ C[i - 1][j - 1] ) % MOD;
        }
    }
    frac[0] = 1;
    for(int i = 1; i <= n; i++) frac[i] = ( frac[i - 1] *1ll* i ) % MOD;
}
inline int calc(int x, int y){
   // cerr << x << " " << y << " " << C[x - 1][y - 1] << endl;
    return C[x - 1][y - 1];
}

int main()
{
#ifdef LOCAL_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    clock_t c1 = clock();
    
    int n = read();
    init();
    int ans = 0;
    for(int len = 1; ; len ++){
        if(n < len * 3) break;
        // cerr << "len = " << len << endl;
        ans = (ans +0ll+ (
            calc(n - len * 2, len)// *1ll* frac[len]
        ) % MOD) % MOD;
    }
    cout << ans << endl;
    
    
    
    std::cerr << "\n\nTime:  " << clock() - c1 << "  ms" << std::endl;
	return 0;
}
//--------------main finish line-------------------




/*

*/

/*

*/






/*

*/


/*

*/


Measured memory_bytes: 18524
#include <bits/stdc++.h>
using namespace std;
#define mod 1e9+7
typedef long long ll; 

 int main(){
  ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
   ll n;
   cin>>n;
   if(n>=30) cout<<"Yes";
   else cout<<"No";
  
    return 0;
}

Measured memory_bytes: 3668
#include <set>
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> a(N), b(N), c(N), d(N), tp(2 * N), y(2 * N);
	for (int i = 0; i < N; i++) cin >> a[i] >> b[i], tp[a[i]] = 0, y[a[i]] = b[i];
	for (int i = 0; i < N; i++) cin >> c[i] >> d[i], tp[c[i]] = 1, y[c[i]] = d[i];
	int ret = 0; set<int> s;
	for (int i = 0; i < 2 * N; i++) {
		if (tp[i] == 0) s.insert(y[i]);
		else {
			set<int>::iterator it = s.lower_bound(y[i]);
			if (it != s.begin()) {
				s.erase(--it);
				ret++;
			}
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
L=[]
for i in range(N) :
  L.append(int(input()))
L.sort()
S=10**9
for i in range(N-K+1) :
  if (L[i+K-1]-L[i]) <= S :
    S=(L[i+K-1]-L[i])
print(S)

Measured memory_bytes: 7384
#include<bits/stdc++.h>
using namespace std;
int n,t,z,x,y,ans=0,f[100010];
int main()
{	
    cin>>n>>t;
    for(int i=1;i<=n;i++)cin>>f[i];
    for(int i=n;i>0;i--)
	{
		x=max(f[i],x);
		z=max(x-f[i],z);
	}
    for(int i=n;i>0;i--)
	{
		y=max(f[i],y);
		if(y-f[i]==z)ans++;
	}
    cout<<ans<<endl;
    return 0 ;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
int main(){
  std::string s,t;
  std::cin>>s>>t;
  int inf=1001001,p=inf;
  if(t.size()>s.size()){std::cout<<"UNRESTORABLE"<<"\n";return 0;}
  for(int i=0;i<=s.size()-t.size();++i){
    int j=0;
    bool f=true;
    while(j<t.size()){
      if(s[i+j]=='?'||s[i+j]==t[j]){++j;}
      else{f=false;break;}
    }
    p = (f?i:p);
  }
  if(p==inf){std::cout<<"UNRESTORABLE"<<"\n";}
  else{
    for(int i=0;i<s.size();++i){
      if(i>=p&&i<p+t.size()){std::cout<<t[i-p];}
      else{std::cout<<(s[i]=='?'?'a':s[i]);}
    }
    std::cout<<"\n";
  }
}
    

Measured memory_bytes: 256
n = int(input())
t_,x_,y_ = 0,0,0

def trip(t,x,y):
  l = abs(x)+abs(y)
  if t-l >= 0 and (t-l)%2 == 0:
    return 1
  else:
    return 0
  
e = 0
for _ in range(n):
  t,x,y = map(int,input().split())
  t_ = t - t_
  x_ = x - x_
  y_ = y - y_
  if trip(t_,x_,y_) == 1:
    continue
  else:
    e = 1
    print('No')
    break
if e == 0:
  print('Yes')
  

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod = 1000000007;		





int main() {

	VI v(5);
	REP(i, 5)cin >> v[i];
	int k;
	cin >> k;
	sort(ALL(v));
	if (v[4] - v[0] > k)cout << ":(" << endl;
	else cout << "Yay!" << endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
const int N = 16;
char s[N];
int n, cnt;
int main(){
	scanf("%s", s);
	n = strlen(s);
	for(Rint i = 0;i < n;i ++)
		if(s[i] == 'x') ++ cnt;
	if(cnt >= 8) puts("NO");
	else puts("YES");
}

Measured memory_bytes: 256
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}
/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll k,m,i,j,n,c,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		double m;
		cin>>n>>m;
		k=100*m+0.01;
		c=n*k;
		k=(c/100);
		cout<<k;

		
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3776
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <queue>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    int ans = 1;
    for (int i = 1; i <= n; i++)
    {
        if (ans * 2 == i)
        {
            ans *= 2;
        }
    }
    cout << ans << endl;
}

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

int main(){
	long long int n,ans=0,ouo=0,tmp;
	long long int quq=0,ququq=0;
	long long int ouq=0; 
	long long int ans2,ans4;
	map <long long int,long long int> mp;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ouo;
		mp[ouo]++;
		if(mp[ouo]==2) {
			if(ouo>quq) quq=ouo;
			if(quq>ququq){
				tmp = quq;
				quq = ququq;
				ququq = tmp;
			}
		}
		if(mp[ouo]==4){
			if(ouo>ouq){
				ouq = ouo;
			}
		}
	}
	ans2 = quq * ququq;
	ans4 = ouq * ouq;
	if(ans2>=ans4) ans = ans2;
	else ans = ans4;
	cout<<ans<<endl;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef long double ld;
 
#define mkp make_pair
#define pb push_back
#define MOD 1000000007
#define inp_s ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define all(v) (v).begin(), (v).end()
#define sz(a) a.size()
#define mset(a, v) memset(a, v, sizeof(a))
 
int main(){
    inp_s;
    ll n, a[300010];
    cin >> n;
    for(ll i=1 ; i<=3*n ; i++){
        cin >> a[i];
    }
    priority_queue<ll, vector<ll>, greater<ll> > ql;
    priority_queue<ll, vector<ll> > qr;
    ll suml = 0, sumr = 0;
    for(ll i=1 ; i<=n ; i++){
        ql.push(a[i]);
        suml += a[i];
    }
    for(ll i=2*n+1 ; i<=3*n ; i++){
        qr.push(a[i]);
        sumr += a[i];
    }
    ll l[100010], r[100010];
    l[n] = suml, r[2*n+1] = sumr;
    for(ll i=n+1 ; i<=2*n ; i++){
        if(ql.top() < a[i]){
            suml += a[i] - ql.top();
            ql.pop();
            ql.push(a[i]);
        }
        l[i] = suml;
    }
    for(ll i=2*n ; i>n ; i--){
        if(qr.top() > a[i]){
            sumr += a[i] - qr.top();
            qr.pop();
            qr.push(a[i]);
        }
        r[i] = sumr;
    }
    ll ans = l[n] - r[n+1];
    for(ll i=n+1 ; i<=2*n ; i++){
        ans = max(ans, l[i] - r[i+1]);
    }
    cout << ans;
    return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    double tmp = log(n) / log(3);
    int ans = tmp;
    if (n > pow(3, ans)) ans++;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3448
/*
                    author         : TAPAN SAVANI 
                    codeforces     : savanitapan2001
                    codechef       : savanitapan17
*/

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

░██╗░░░░░░░██╗░█████╗░██████╗░██╗░░██╗  ██╗░░██╗░█████╗░██████╗░██████╗░
░██║░░██╗░░██║██╔══██╗██╔══██╗██║░██╔╝  ██║░░██║██╔══██╗██╔══██╗██╔══██╗
░╚██╗████╗██╔╝██║░░██║██████╔╝█████═╝░  ███████║███████║██████╔╝██║░░██║
░░████╔═████║░██║░░██║██╔══██╗██╔═██╗░  ██╔══██║██╔══██║██╔══██╗██║░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝██║░░██║██║░╚██╗  ██║░░██║██║░░██║██║░░██║██████╔╝
░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝  ╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚═════╝░
 
------------------------------------------------------------------------
*/

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

#define HAPPY_CODING              \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define Debug(x) cout << #x " = " << (x) << endl
#define SORT(a) sort(a.begin(), a.end())
#define SORTR(a) sort(a.rbegin(), a.rend())
#define mod 1000000007
#define pi 3.141592653589793238
#define ll long long int
#define ull unsigned long long
#define be begin()
#define en end()
#define FOR(i, a, b) for (long long int i = a; i < b; i++)
#define FORI(i, a, b) for (int i = a; i >= b; i--)

typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef vector<PI> VPI;

int main()
{
    HAPPY_CODING;

    int n, ans=0;
    cin >> n;

    FOR(i,1,n)
        ans += (n-1)/i;

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int A,B; cin >> A >> B;
    if(A>9 || B>9){
        cout << -1 << endl;
    }else{
        cout << A*B << endl;
    }
    return 0;
}


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

int main(){
  int a, b;
  cin >> a >> b;
  if(a > b){
    cout << "a > b" << endl;
  }else if(a < b){
    cout << "a < b" << endl;
  }else if(a == b){
    cout << "a == b" << endl;
  }
}



Measured memory_bytes: 3116
import Control.Monad (replicateM)
import Data.List (transpose, inits, sortOn)

main :: IO ()
main = do
  [n, c] <- map read . words <$> getLine :: IO [Int]
  xv <- replicateM n (map read . words <$> getLine) :: IO [[Int]]
  let [xs, vs] = transpose xv
      as' = scanl (\(v1,_x1) (v2,x2) -> (v1 + v2, x2)) (0, 0) $ zip vs xs
      bs' = scanr (\(v1,x1) (v2,_x2) -> (v1 + v2, x1)) (0, 0) $ zip vs (map (c-) xs ++ [0])
      as'' = scanl1 (\(v1,x1) (v2,x2) -> if v1-x1 >= v2-x2 then (v1,x1) else (v2,x2)) as'
      bs'' = scanr1 (\(v1,x1) (v2,x2) -> if v1-x1 >= v2-x2 then (v1,x1) else (v2,x2)) bs'
      cs'' = zipWith (\(v1,x1) (v2,x2) -> v1 - x1 + v2 - x2 - min x1 x2) as'' bs''
  print $ maximum cs''


Measured memory_bytes: 223612
// Problem : B - Crane and Turtle
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define Sort(a)	sort(a.begin(),a.end())
#define rev(a)	reverse(a.begin(),a.end())
#define all(a)	(a).begin(),(a).end()
#define vll vector<long long int>
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971
#define INF 1e18

#define MAX 200005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}
lli power(lli a,lli b){lli res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}
lli Ceil(lli a,lli b){lli res=a/b;if(a%b!=0)	res++;return res;}

template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

lli dxx[]={1,1,0,-1,-1,-1,0,1};
lli dyy[]={0,1,1,1,0,-1,-1,-1};
lli dx[]={1,0,-1,0};
lli dy[]={0,1,0,-1};

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
void solve(lli the)
{
	char ch;
	db aa,bb,cc,dd,xx;
	string s1,s2,s3,str;
    lli i,j,k,a,b,c,d,n,m,l,r,x,y,z,low,high,mid,sum=0,ans=0,temp,t;
    cin >> x >> y;
    for(c=0;c<=100;c++){
    	for(t=0;t<=100;t++){
    		if(c+t!=x)	continue;
    		l=c+c+t+t+t+t;
    		if(l==y){
    			cout<<"Yes";
    			return;
    		}
    	}
    }
    cout<<"No";
    
    
}













int main()
{
	long long int t=1,c=1;
	// scanf("%lld",&t);
	while(t--){
		solve(c);
		c++;
	}
	return 0;
}
/* UJJWAL KESHRI */

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

int main() {

  int n, x;
  cin >> n >> x;
  vector<int> m(n);
  for(int i = 0; i < n; i++) {
    cin >> m.at(i);
  }
  
  int ans = 0;
  sort(m.begin(), m.end());
  for(int i = 0; i < n; i++) {
    if(x >= m.at(i)) {
      x = x - m.at(i);
      ans++;
    } else {
      break;
    }
  }
  if(x >= m.at(0)) {
    for(int i = 0; i < 10e10; i++) {
      if(x >= m.at(0)) {
        x = x - m.at(0);
        ans++;
      } else {
        break;
      }
    }
  }
  cout << ans << endl;
}

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

int main(){
  int k, a ,b;
  cin >>k;
  cin >> a >> b;
  for(int i = a; i <= b; i++){
    if(i % k == 0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll A,B,V,W,T;
int main(){
	cin>>A>>V>>B>>W>>T;
	if(A+V*T>=B+W*T && A-V*T<=B-W*T)puts("YES");
	else puts("NO");
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int a,b,sum=0;
	cin>>a>>b;
	if(a>b){
		sum=a;
		a--;
	}
	else{
		sum=b;
		b--;
	}
	if(a>b){
		sum+=a;
	}
	else sum+=b;
	cout<<sum<<endl;
 	return 0;
 }


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

int main() {
    ll N,M;
    string S;
    cin >> N >>M>> S;
    N++;
    reverse(S.begin(),S.end());
    vector<int> ans;
    int i=0;
    while(i<N-1){
        int next = min(i+M,N-1);
        // cerr <<"next="<< next <<"S[next]=" << S[next] <<  endl;
        while(S[next] != '0'){
            next--;
        }
        if(next==i){
            cout << -1 << endl;
            return 0;
        }
        // cerr <<"next - i=" << next-i <<endl;;
        ans.push_back(next-i);
        i= next;
    }
    reverse(ans.begin(),ans.end());
    for(int a:ans){
        cout << a<<" ";
    }
    cout <<endl;
    return 0;
}

Measured memory_bytes: 4036
//it was hard to write
//so it should be hard to read
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define ll long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define last(x) (x).size() - 1
#define mp make_pair

using namespace std;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef double ld;

const int MAXN = 1e5 + 5;
const ll INF = 1e18 + 7;
const int inf = 1e9 + 7;
const double EPS = 1e-9;

int n, k, d[MAXN];

bool check(int x) {
    while (x) {
        int cur = x % 10;
        for (int i = 1; i <= k; i++) {
            if (cur == d[i]) return 0;
        }
        x /= 10;
    }
    return 1;
}

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    cin >> n >> k;
    for (int i = 1; i <= k; i++) {
        cin >> d[i];
    }
    while (check(n) == 0) {
        n++;
    }
    cout << n;
    return 0;
}


Measured memory_bytes: 256