akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;
int rate[20];
int main(void){
    int n,a,k,xa=0,na=0;cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        k=a/400;
        rate[k]++;
        if(k>=8)xa++;
    }
    for(int i=0;i<8;i++){
        if(rate[i]>0)na++;
    }
    cout<<max(na,1)<<' '<<na+xa<<endl;
    
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x%N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x)%N;
		y = y >> 1;
		x = (x * x)%N;
	}
	return res;
}
double dist(ll x1,ll y1, ll x2,ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n, h, ans = 0;
	cin >> n >> h;
	f(i, 0, n)
	{
		ll temp;
		cin >> temp;
		if (temp >= h)
		{
			ans += 1;
		}
	}
	cout << ans;
	return 0;
}


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

using namespace std;

int main()
{
	int A,B,C,ans=0;
	cin>>A>>B>>C;
	
	if(A>=C)
		ans = B+C;
	else
	{
		ans += A;
		C -= A;
		if(B<C)
			ans += 2*B + 1;
		else
			ans += B+C;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int times[100001];

void add(int start, int end, int num) {
  int i;

  for (i = start; i < end; i++)
    times[i] += num;
}

int main() {
  int n, T, arrive, leave, i, out = 0;

  scanf("%d %d", &n, &T);
  scanf("%d %d", &arrive, &leave);

  if (50000 > leave - arrive) {
    memset(times, 0, sizeof(times));
    add(arrive, leave, 1);

    for (i = 1; i < n; i++) {
      scanf("%d %d", &arrive, &leave);
      add(arrive, leave, 1);
    }
  } else {
    /*    for (i = 0; i < T; i++)
      times[i] = n;
    
    add(0, arrive, -1);
    add(out, T, -1);

    for (i = 1; i < n; i++) {
      scanf("%d %d", &arrive, &leave);
      add(0, arrive, -1);
      add(leave, T, -1);
    }
    */

    for (i = 0; i < T; i++)
      times[i] = n;

    add(0, arrive, -1);
    add(leave, T, -1);
    
    for (i = 1; i < n; i++) {
      scanf("%d%d", &arrive, &leave);
      add(0, arrive, -1);
      add(leave, T, -1);
    }
  }
  
  int max = 0;


  for(i=0; i<T; i++){
    max = (max < *(times+i) ? *(times+i) : max);
  }

  out = max;
  /*
  for (i = 0; i < T; i++) {
    if (out < times[i])
      out = times[i];
  }
  */

  printf("%d\n", out);
}


Measured memory_bytes: 2236
#include<bits/stdc++.h>
//***** Jai Gurudev *****//
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define all(x) x.begin(),x.end()
#define vii vector<pair<int,int> >
#define vll vector<pair<ll,ll> >
#define pb push_back
#define fi first
#define se second
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define PI 3.1415926535897932384626433832795
#define inf64 LLONG_MAX
#define inf32 INT_MAX
#define mod 1000000007
using namespace std;
vl seive(){ll n=2;vl pr(200000,-1);for(int i=n;i<200000;i++){if(pr[i]==-1)pr[i]=1;else continue;for(int j=2*i;j<200000;j+=i)pr[j]=0;}return pr;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
bool isprime(ll n) {bool flag=true;for(ll i=2; i<=sqrt(n);i++){if(n%i==0){flag=false;break;}}return flag;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main()
{
	fast
//	int t;
//	cin>>t;
//	while(t--)
//	{
		string s;
		cin>>s;
		int ct=0,mx=0;
		for(int i=0;i<s.size();i++)
		{
			if(s[i]=='R')
			ct++;
			else
			{
				mx=max(mx,ct);
				ct=0;
			}
		}
		mx=max(mx,ct);
		cout<<mx<<"\n";
//	}
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
	int N,K,S;
	cin>>N>>K>>S;
	if(S==1){
		for(int i=0;i<K;i++){
			cout<<1<<" ";
		}
		for(int i=K;i<N;i++){
			cout<<2<<" ";
		}
	}else if(S==1000000000){
		for(int i=0;i<K;i++){
			cout<<S<<" ";
		}
		for(int i=K;i<N;i++){
			cout<<1<<" ";
		}
	}else{
		for(int i=0;i<K;i++){
			cout<<S<<" ";
		}
		for(int i=K;i<N;i++){
			cout<<S+1<<" ";
		}
	}
	return 0;
}

Measured memory_bytes: 1280
#include<cstdio>
#include<cstring>
#include<algorithm>
using std::max;
const int MAXN=110;
const int MAXW=100010;

long long f[MAXN][MAXW];
int a[MAXN],v[MAXN];

int main(){
	int n,w;scanf("%d%d",&n,&w);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&v[i]);
		for(int j=w;~j;j--)
			f[i][j]=max(f[i-1][j],j+a[i]<=w?f[i-1][j+a[i]]+v[i]:0);
	}
	// printf("%d\n",f[2][5]);
	long long ans=0;
	for(int i=0;i<=w;i++)
		ans=max(ans,f[n][i]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 79232
<?php
/**
 * ABC132
 * A - Fifty-Fifty
 */

// $s = trim(fgets(STDIN));
// fscanf(STDIN, "%d %d", $a, $b);
// $n = array_map('intval', explode(' ', trim(fgets(STDIN))));

$s = trim(fgets(STDIN));
for ($i = 0; $i < 4; $i++) {
    $sum[$s[$i]]++;
}

foreach ($sum as $type) {
    if ($type != 2) {
        echo 'No', PHP_EOL;
        exit;
    }
}

echo 'Yes', PHP_EOL;


Measured memory_bytes: 4728
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <random>
#include <ctime>

#define MOD 1000000007

const long long INF = 10000000000000000;

using namespace std;

int func(int A, int B, int C){
	if(A%2==1 || B%2==1 || C%2==1) return 0;
	if(A==B && B==C) return -1;
	return func((B+C)/2,(A+C)/2, (A+B)/2)+1;
}

int main(){

	int A,B,C;
	cin>>A>>B>>C;
	cout<<func(A,B,C)<<endl;
	return 0;	
}

Measured memory_bytes: 256
import itertools
import math

def dist(s, g):
    sx, sy = s
    ex, ey = g

    return math.sqrt((ex - sx)**2 + (ey - sy)**2)

# input
n = int(input())
points = [ [int(x) for x in input().split()] for _ in range(n) ]

# calculate roots
roots = set(itertools.permutations(range(n)))

distance = [0] * len(roots)
idn = 0
for root in roots:
    for i in range(len(root) - 1):
        tmp_dist = dist(points[root[i]], points[root[i + 1]])
        distance[idn] += tmp_dist
    
    idn += 1

print(sum(distance) / len(distance))


Measured memory_bytes: 10860
#include <bits/stdc++.h>
 
using namespace std;
 
string temp = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
int main()
{
  int W, H, P;
  bool bit[1005][1005];
  bool cur[8][105][105];
 
  __int128 mask, slow[1005], obj[8][105];
   
  while(cin >> W >> H >> P, W) {
    for(int i = 0; i < H; i++) {
      string S;
      cin >> S;
      for(int j = 0; j < S.size(); j++) {
        auto bb = temp.find(S[j]);
        for(int k = 0; k < 6; k++) {
          if(j * 6 + k >= W) break;
          bit[i][j * 6 + k] = (bb >> (5 - k)) & 1;
        }
      }
    }
 
 
    for(int i = 0; i < P; i++) {
      string S;
      cin >> S;
      for(int j = 0; j < S.size(); j++) {
        auto bb = temp.find(S[j]);
        for(int k = 0; k < 6; k++) {
          if(j * 6 + k >= P) break;
          cur[0][i][j * 6 + k] = (bb >> (5 - k)) & 1;
        }
      }
    }
 
    for(int i = 0; i < P; i++) {
      for(int j = 0; j < P; j++) {
        cur[4][i][j] = cur[0][j][i];
      }
    }
 
    for(int i = 0; i < 8; i++) {
      if(i % 4 == 0) continue;
      for(int j = 0; j < P; j++) {
        for(int k = 0; k < P; k++) {
          cur[i][j][k] = cur[i - 1][k][P - j - 1];
        }
      }
    }
 
 
    mask = ((__int128) 1 << P) - 1;
    for(int i = 0; i < 8; i++) {
      for(int j = 0; j < P; j++) {
        obj[i][j] = 0;
        for(int k = 0; k < P; k++) {
          obj[i][j] <<= 1;
          obj[i][j] |= cur[i][j][k];
        }
      }
    }
 
    for(int i = 0; i < H; i++) {
      slow[i] = 0;
      for(int j = 0; j < P; j++) {
        slow[i] <<= 1;
        slow[i] |= bit[i][j];
      }
    }
 
 
    int ret = 0;
 
    for(int j = 0; j <= W - P; j++) {
      for(int i = 0; i <= H - P; i++) {
        for(int k = 0; k < 8; k++) {
          bool rematch = true;
          for(int l = 0; l < P; l++) {
            rematch &= slow[i + l] == obj[k][l];
          }
          if(rematch) {
            ++ret;
            break;
          }
        }
      }
      for(int i = 0; i < H; i++) {
        slow[i] <<= 1;
        slow[i] |= bit[i][j + P];
        slow[i] &= mask;
      }
    }
    cout << ret << endl;
  }
 
}

Measured memory_bytes: 4140
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	string s,t;
	int n, k;
	cin >> n >> s >> k;
	t = s.substr(k - 1, 1);
	for (int i = 0; i < n; ++i) {
		if (s.substr(i, 1) != t) { 
			s.replace(i, 1, "*"); 
		}
	}
	cout << s << "\n";
	return 0;	
}

Measured memory_bytes: 256
n = int(input())
d = [list(map(int,input().split())) for i in range(n)]
ans = "No"
for i in range(n-2):
    if d[i][0]==d[i][1] and d[i+1][0]==d[i+1][1] and d[i+2][0]==d[i+2][1]:
        ans = "Yes"
print(ans)

Measured memory_bytes: 62352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#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;}
#define OUT(x) cout << x << endl
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 100000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  IN(ll,N);
  AIN(ll, A, N);
  bool ans = true;
  REP(i,N){
    if(A.at(i) % 2 == 0 && !(A.at(i) % 3 == 0 || A.at(i) % 5 == 0))
      ans = false;
  }
  if(ans)
    OUT("APPROVED");
  else
    OUT("DENIED");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int x;
    cin >> x;
    int a = x / 1000;
    int b = (x - a * 1000) / 100;
    int c = (x - a * 1000 - b * 100) / 10;
    int d = x % 10;
    vector<int> op{1, -1};
    for (int op1 : op)
    {
        for (int op2 : op)
        {
            for (int op3 : op)
            {
                if (a+op1*b+op2*c+op3*d == 7) {
                    string B,C,D;
                    if (op1 == 1) {
                        B = "+" + to_string(b);
                    }else
                    {
                        B = "-" + to_string(b);
                    }
                    if (op2 == 1) {
                        C = "+" + to_string(c);
                    }else
                    {
                        C = "-" + to_string(c);
                    }
                    if (op3 == 1) {
                        D = "+" + to_string(d);
                    }else
                    {
                        D = "-" + to_string(d);
                    }
                    cout << a << B << C << D << "=7" << endl;
                    return 0;
                }
                
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;
    cin >> n;
    ll d[n][2];
    for (ll i = 0; i < n; i++) cin >> d[i][0] >> d[i][1];
    for (ll i = 1; i < n - 1;i++){
        if(d[i-1][0]==d[i-1][1] and d[i][0]==d[i][1] and d[i+1][0]==d[i+1][1]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3552
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n;
    cin >> n;
    vl p(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    ll mini = INF;
    ll ret  = 0;
    for (int i = 0; i < n; ++i) {
        if (mini >= p[i])
            ret++;
        chmin(mini, p[i]);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<cmath>
#include <numeric>
#include<iomanip>
#include <cstdint>

using namespace std;

int counter(int x) {
	if (x == 0) {
		return 0;
	}
	else {
		return counter(x >> 1) + (x & 1);
	}
}

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	vector<vector<pair<int, int>>>v(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		for (int j = 0; j < a[i]; j++) {
			int x, y;
			cin >> x >> y;
			x--;
			v[i].emplace_back(x, y);
			//cout << v[i][0].second << endl;
		}
	}
	int ans = 0;
	for (int bits = 0; bits < (1 << n); bits++) {
		bool ok = true;
		for (int i = 0; i < n; i++) {
			if (!(bits & (1 << i))) {
				continue;
			}
			else {
				for (int j = 0; j < a[i]; j++) {
					if (((bits >> v[i][j].first) & 1) ^ v[i][j].second) {
						ok = false;
					}
				}
			}
		}
		if (ok) {
			ans = max(ans, counter(bits));
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
using namespace std;
int N;
double t, x, h, H = 0;
int main() {
  cin >> N >> t;
  for (int i = 0; i < N; i++) {
    cin >> x >> h;
    double tmp = t * (h / x);
    if (H < tmp) {
      H = tmp;
    }
  }
  cout << setprecision(10) << H << '\n';
  return 0;
}


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

int dp[5005][5005];

int main(){
    string s;
    int n;
    cin >> n >> s;
    for(int i = n-1; i >=0; --i){
        for(int j = n-1; j >=0; --j){
            if (s[i]  != s[j]) dp[i][j]=0;
            else dp[i][j] = dp[i+1][j+1]+1;
        }
    }
    int ans=0;
    rep(i,n)rep(j,n){
        if(i >= j)continue;
        int now = min(dp[i][j], j-i);
        ans = max(ans, now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 98048
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define N ((ll)(2e6+100))
#define MAX ((ll)(1e18+100))
#define ARRS ((ll)(2e6+100))
#define MOD ((ll)(998244353))
#define pb push_back

ll n;
string s;
map<string,ll> mp;

ll go(string s){
	if(mp[s])return mp[s]%MOD;
	if(s=="")return 1;
	//cout<<s<<endl;
	mp[s]=(s[0]-'0'+1)*go(s.substr(1));
	
	for(int i=1; i<=s.size(); i++){
		string se=s.substr(i);
		string w=s.substr(0,i);
		for(int k=2; k<=s.size(); k++){
			//cout<<s<<" -> "<<i<<" "<<k<<" "<<se<<" "<<endl;
			if(i*k>s.size())break;

			se=se.substr(i);
			//cout<<w<<" "<<se<<" "<<i<<" "<<k<<endl;
			for(int t=0; t<i; t++)
				w[t]=((w[t]-'0')&(s[t+(k-1)*i]-'0'))+'0';
			//cout<<s<<"-> "<<w<<" "<<se<<" "<<i<<" "<<k<<endl;

			mp[s]=(mp[s]+go(w)*go(se))%MOD;
		}
	}

	return mp[s]%MOD;
}

int main(){
	cin>>s;
	cout<<go(s);
}


Measured memory_bytes: 6528
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long K = sc.nextLong();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
    int[] F = new int[N];
    for (int i = 0; i < N; i++) {
      F[i] = sc.nextInt();
    }
    
    Arrays.sort(A);
    Arrays.sort(F);
    
    long l = -1L;
    long r = 1001001001001L;
    while (l+1 < r) {
      long m = (l+r)/2;
      if (ok(m, N, K, A, F)) {
        r = m;
      } else {
        l = m;
      }
    }
    System.out.println(r);
  }
  
  private static boolean ok(long key, int N, long K, int[] A, int[] F) {
    long sum = 0;
    for (int i = 0; i < N; i++) {
      sum += Math.max(0L, A[i]-key/F[N-1-i]);
    }
    return sum <= K;
  }
}

Measured memory_bytes: 100756
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,a,b = inm()
v = inl()
v.sort(reverse=True)
ave = sum(v[:a])/a
print(ave)
if v[0]>v[a-1]:
    l = a-1
    while l>0 and v[l-1]==v[a-1]:
        l -= 1
    r = a-1
    while r<n-1 and v[r+1]==v[a-1]:
        r += 1
    dend = sor = 1
    #ddprint(f"a {a} l {l} r {r}")
    # comb(r-l+1, a-l)
    for i in range(a-l):
        dend *= r-l+1-i
        sor *= a-l-i
    p = dend//sor
    #ddprint(f"i {i} dend {dend} sor {sor} inc {dend//sor} p {p}")
else:
    r = a-1
    while r<n-1 and v[r+1]==v[a-1]:
        r += 1
    # c=min(b,r+1), sum< j=a..c >[comb(r+1,j)]
    p = 0
    #ddprint(f"a {a} l {l} r {r}")
    for j in range(a,min(b,r+1)+1):
        dend = sor = 1
        for i in range(j):
            dend *= r+1-i
            sor *= j-i
        p += dend//sor
        #ddprint(f"i {i} dend {dend} sor {sor} inc {dend//sor} p {p}")
print(p)


Measured memory_bytes: 38640
#include<stdio.h>

 int main ()
 {
     int n;
      int a,b;
     int i,j;
     while (scanf ("%d %d", &a, &b)!=EOF  )
     {
         j=0;
         n=a+b;
         for (i=n;i>0;i/=10)
            {
                 
                 j++;
            }
         printf("%d\n",j);
      }
    return 0;
 }

Measured memory_bytes: 600
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

string S, T;

int main() {
    cin >> S >> T;
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == T[i]) ans++;
    }

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


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

ll power(ll a, ll b){
	ll ans = 1;
	while(b){
		if(b&1){
			ans = (ans * a)%mod;
		}
		b = b>>1;
		a = (a * a)%mod;	
	}
	return ans;
}

ll inv(ll a){
	return power(a,mod-2);
}

vector<ll> f(100005);

ll C(ll n, ll r){
	if(n<r)
		return 0;
	return  (f[n] * inv(f[r] * f[n-r] %mod) )%mod;	
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	for(ll i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	
	f[0] = 1ll; 
	for(ll i=1;i<=100004;i++){
		f[i] = (f[i-1] * i) %mod;
	}

	ll ans = 0;
	
	for(int i=1;i<=n;i++){
		ans = (ans + (a[i] * C(i-1,k-1))%mod )%mod;
		ans = (ans - (a[i] * C(n-i,k-1))%mod + mod )%mod;
	}
	cout<<ans;
	
	return 0;
}
	
	
	
	
	
	
	
	
	
	
	

























Measured memory_bytes: 1792
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
n,k,q=input2()
A=[int(input()) for _ in range(q)]

P=[0]*n


for a in A:
	P[a-1]+=1

for p in P:
	if p >q-k:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 13600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Reader.init(System.in);
		StringBuffer output=new StringBuffer("");
		PrintWriter out=new PrintWriter(System.out);
		int n=Reader.nextInt();
		int k=Reader.nextInt();
		int[] arr=new int[n];
		for(int i=0;i<n;i++) arr[i]=Reader.nextInt();
		int[] cost=new int[n];
		Arrays.fill(cost, Integer.MAX_VALUE);
		cost[0]=0;
		if(n>1) {
		cost[1]=Math.abs(arr[1]-arr[0]);
		for(int i=2;i<n;i++) {
			for(int j=i-1;j>=Math.max(0, i-k);j--) {
				cost[i]=Math.min(cost[i], Math.abs(arr[i]-arr[j])+cost[j]);
			}
		}
		}
		output.append(cost[n-1]);
		out.write(output.toString());
		out.flush();
	}

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
 
    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
 
    /** get next word */
    static String nextLine() throws IOException{
    	return reader.readLine();
    }
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    
    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}


Measured memory_bytes: 34444
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c = s.charAt(0);
        int count = 0;
        for(int i=0; i<s.length();i++){
            if(count >= 3){
                break;
            }
            if(c == s.charAt(i)){
                count++;
            }else{
                c = s.charAt(i);
                count = 1;
            }
        }

        if(count >= 3){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35680
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define num(a) a-'0'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<#x<<":"<<x<<" "
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	ld a,b;
	cin>>a>>b;
	ld l8,u8,l10,u10;
	l8=a*100/8;
	u8=(a+1)*100/8;
	l10=b*100/10;
	u10=(b+1)*100/10;
	int h=l8;
	if(l8>static_cast<int>(l8)){
		h=static_cast<int>(l8+1);
	}
	for(int i=h;i<u8;i++){
		if(i>=l10 && i<u10){
			cout<<i<<ln;
			return;
		}
	}
	cout<<-1<<ln;
}	

int main(){
	boost_io;
	cout<<setprecision(10);
	solve();
	return 0;
}


Measured memory_bytes: 3740
import java.util.Scanner;

public class Main {
	static String s = "";

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String ans = ":(";

		int N = sc.nextInt();

		for(int X=1; X<=50000; X++) {
			int value = (int)(X * 1.08);
			if(value == N) {
				ans = String.valueOf(X);
				break;
			}
		}

		System.out.println(ans);

	}

}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int N, M;
int num = 0;
int swt[11];

int K[11];
int s[11][11];
int p[11];
int ans = 0;

void solve(int i) {
    if (i >= N) {
        //
        int sum = 0;
        rep(a, M) {
            int tmp = 0;
            rep(b, K[a]) {
                tmp += swt[s[a][b]];
            }
            if (tmp%2 == p[a]) {
                sum++;
            }
        }
        if (sum == M) {
            ans++;
        }
        return;
    }

    swt[i] = 0;
    solve(i+1);
    swt[i] = 1;
    solve(i+1);
    return;
}

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

    rep(i, M) {
        int k;
        cin >> k;
        K[i] = k;
        rep(j, k) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }

    rep(i, M) cin >> p[i];
    solve(0);

    cout << ans << endl;
}


Measured memory_bytes: 256
#template
def inputlist(): return [int(j) for j in input().split()]
#template
#issueから始める
N,T = inputlist()
ans = 10**9
for i in range(N):
    c,t = inputlist()
    if t <= T:
        ans = min(ans,c)
if ans == 10**9:
    ans = 'TLE'
print(ans)

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

using namespace std;

int main()
{
    long long n,w,e,an,W,E;
    cin>>n;
    long long a[n];
    char s[n+4];
    cin>>s;
    w=0;
    for(long long i=0; i<n; i++)
        if(s[i]=='W')w++;
    W=w;E=n-w;
    an=min(w,n-w);
    w=e=0;
    for(long long i=0; i<n; i++)
    {
        if(s[i]=='W')w++;
        else e++;
        a[i]=E-e+w;
    }
    w=a[0];
    for(long long i=1;i<n;i++)
        if(a[i]<w)w=a[i];
    cout<<min(an,w);
    return 0;
}


Measured memory_bytes: 2944
#include<stdio.h>
int main(void)
{
	long long int i,x=1,N,A[100001];
	
	scanf("%lld",&N);
	
	for(i=0;i<N;i++){
		scanf("%lld",&A[i]);
	}
	
	for(i=0;i<N;i++){
		if(A[i]==0){
			x=0;
			puts("0");
			return 0;
		}
	}
	
	for(i=0;i<N;i++){
		if(x<=powl(10,18)/A[i]){
			x *=A[i];
		}
		else{
			puts("-1");
			return 0;
		}
	}
	
	printf("%lld",x);
	
	return 0;
}

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

const int mod = 200003;
int n, A[500010], lg[mod];

const int maxn = 524288, BLOCK = 100000;
const long double PI = acos(-1);

typedef long long ll;

long long filp[maxn], Ans[maxn], limit = 1, cnt = 0;
struct C {
    C(long double a = 0, long double b = 0) { x = a, y = b; }
    long double x, y;
};
C operator+(C a, C b) {
    return C(a.x + b.x, a.y + b.y);
}
C operator-(C a, C b) {
    return C(a.x - b.x, a.y - b.y);
}
C operator*(C a, C b) {
    return C(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}
C A1[maxn], B1[maxn], A2[maxn], B2[maxn], X[maxn];

inline void FFT(C* f, short inv) {
    for (int i = 0; i < limit; ++i)
        if (i < filp[i])
            std::swap(f[i], f[filp[i]]);
    for (int p = 2; p <= limit; p <<= 1) {
        int len = p >> 1;
        C tmp = C(std::cos(PI / len), inv * std::sin(PI / len));
        for (int k = 0; k < limit; k += p) {
            C buf = C(1, 0);
            for (int l = k; l < k + len; ++l, buf = buf * tmp) {
                C t = f[l + len] * buf;
                f[l + len] = f[l] - t, f[l] = f[l] + t;
            }
        }
    }
    return;
}

inline void solve(C* a, C* b, long long res) {
    for (int i = 0; i < limit; ++i)
        X[i] = a[i] * b[i];
    FFT(X, -1);
    for (int i = 0; i <= mod + mod; ++i)
        Ans[i] += (ll)(X[i].x / limit + 0.5) * res;
}
inline void MTT(C* a, C* b, C* c, C* d) {
    FFT(a, 1), FFT(c, 1), FFT(b, 1), FFT(d, 1);
    solve(a, c, 1LL * BLOCK * BLOCK);
    solve(a, d, BLOCK);
    solve(c, b, BLOCK);
    solve(b, d, 1);
}

int main() {
    lg[1] = 0;
    int cur = 1, tot = 0;
    while (1) {
        cur = (cur + cur) % mod;
        if (cur == 1)
            break;
        lg[cur] = ++tot;
    }
    scanf("%d", &n);
    long long ans = 0;
    for (int i = 1, x; i <= n; i++) {
        scanf("%d", &x);
        ans -= 1LL * x * x % mod;
        if (x)
            A[lg[x]]++;
    }
    for (int i = 0; i <= mod; i++) {
        A1[i] = A[i] / BLOCK, B1[i] = A[i] % BLOCK;
        A2[i] = A[i] / BLOCK, B2[i] = A[i] % BLOCK;
    }
    for (limit = 1; limit <= mod + mod; limit <<= 1)
        ++cnt;
    --cnt;
    for (int i = 0; i < limit; ++i)
        filp[i] = (filp[i >> 1] >> 1) | ((i & 1) << cnt);
    MTT(A1, B1, A2, B2);
    cur = 1;
    for (int i = 0; i <= mod * 2; ++i) {
        ans += 1LL * cur * Ans[i];
        (cur *= 2) %= mod;
    }
    printf("%lld\n", ans / 2);
    return 0;
}

Measured memory_bytes: 94860
# https://img.atcoder.jp/abc119/editorial.pdf
import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i 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(S - T)
            res = min(res, d1, d2)
    print(res)

Measured memory_bytes: 17512
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int X, Y;
string s;
void dfs(int x, int y) {
  if(x == X && y == Y) {
    cout << s << endl;
    return;
  }
  if(x <= 3 && y == 5) return ;
  if(x == 5 && y <= 3) return ;
  if(x == 5 && y == 5) return ;
  if(x == 6 || y == 6) return ;
  int ans = 0;
  s.push_back('A');
  dfs(x + 1, y);
  s.pop_back();
  s.push_back('B');
  dfs(x, y + 1);
  s.pop_back();
  
}
int main() {
  cin >> X >> Y;
  dfs(0, 0);
}



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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A == 1 && B == 1 && C == 1) {
		cout << "0" << endl;
		return 0;
	}
	if (A == B && B == C) {
		cout << "-1" << endl;
		return 0;
	}
	int cnt = 0;
	while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
		int a = A / 2, b = B / 2, c = C /2;
		A = b + c;
		B = a + c;
		C = a + b;
		cnt++;
	}

	cout << cnt << endl;
}

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

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    from collections import Counter

    person_count = int(input())
    relative_positions = Counter(map(int, input().split()))

    if person_count % 2 == 0:
        for key, value in relative_positions.items():
            if (key % 2 == 0) or (value != 2):
                print(0)
                exit()
    else:
        for key, value in relative_positions.items():
            if (key % 2 == 1) or (key == 0 and value != 1) or (key != 0 and value != 2):
                print(0)
                exit()

    print(2 ** (person_count // 2) % (10 ** 9 + 7))


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

int main() {
  int a, b, c; cin >> a >> b >> c;
  int ans;
  if (a < c && b < c)
    ans = a + b;
  else if (a < b && c < b)
    ans = a + c;
  else
    ans = b + c;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s, p;
    int exi;
    
    cin >> s;
    cin >> p;
    s = s+s;
    exi = s.find(p);
    if(exi >= 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3216
<?php
 
$n = trim(fgets(STDIN));
$a = explode(' ', trim(fgets(STDIN)));
$alice = 0;
$bob = 0;
for ($i=0; $i<$n; $i++) {
  $max = 0;
  for($k=0; $k<$n; $k++) {
    if ($a[$k] > $max) {
      $mindex = $k;
      $max = $a[$k];
    }
  }
  $a[$mindex] = 0;
  if ($i % 2 == 0){
    $alice += $max;
  }else{
    $bob += $max;
  }   
}
 
echo ($alice - $bob);

Measured memory_bytes: 3576
import sys
from heapq import *
input = sys.stdin.readline


def main():
    n, m, s = map(int, input().split())
    
    s = min(s, 2500)
    
    railway = [[] for _ in range(n)]
    for i in range(m):
        u, v, a, b = map(int, input().split())
        railway[u-1].append((v-1, a, b))
        railway[v-1].append((u-1, a, b))
    
    exchange = [None]*n
    for i in range(n):
        exchange[i] = tuple(map(int, input().split()))
    
    
    judge = [(0, 0, s)]
    heapify(judge)
    time = [[-1]*2501 for _ in range(n+1)]*n
    
    while judge:
        t, now, money = heappop(judge)
        if time[now][money] == -1:
            time[now][money] = t
        elif time[now][money] <= t:
            continue
        else:
            time[now][money] = min(time[now][money], t)
        
        if money < 2500:
            c, d = exchange[now]
            if time[now][min(2500, money+c)] == -1:
                heappush(judge, (t+d, now, min(2500, money+c)))
        for (v, a, b) in railway[now]:
            if money-a < 0:
                continue
            if time[v][money-a] == -1:
                heappush(judge, (t+b, v, money-a))
    
    for i in range(1, n):
        print(min(time[i]))
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 35904
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  int m = n;
  n = (n+999)/1000;
  n *= 1000;
  int ans = n - m;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

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

    int X, Y;
    cin >> X >> Y;

    if (X % Y == 0) {
        cout << "-1" << endl;
        return 0;
    }

    int i = 1;
    while (true) {
        if (X * i % Y != 0) {
            cout << X * i << endl;
            break;
        }
        i++;
    }
}

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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();
            
            string s2 = "";
            bool yes = true;
            
            for(int i = 0 ; i < s.Length ; i++)
            {
                s2 = s[i].ToString();

                if(Count(s,s2) > 1) yes = false;
            }
            if(yes) Console.WriteLine("yes");
            else Console.WriteLine("no");
        }
        
        public static int Count(string s,string s2)
        {
            int cnt = 0 ;
            cnt = s.Length - s.Replace(s2,"").Length;
            return cnt;
            
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n , k ; 
	cin >> n >> k; 
	if(k>((n-1)*(n-2))/2){
		cout << -1 << endl; 
		return ;
	}
	vector<pii>g;
	rep(i,0,n){
		rep(j,0,i){
			g.pb({j,i});
		}
	}
	cout << n*(n-1)/2 - k<< endl;
	rep(i,k,n*(n-1)/2){
		cout << g[i].fst+1 << ' '<< g[i].snd+1;
		cout << endl; 
	} 
	
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
typedef signed long long int ll;
ll inf=1000000007;



const int MAX = 510000;
const int MOD = 1000000007;

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

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>> v(m);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        v[i]=make_pair(b,a);
    }
    
    sort(v.begin(),v.end());
    
    
    
    int ans=0;
    int tmp=0;
    for(int i=0;i<m;i++){
        if(v[i].first-1>tmp&&v[i].second>tmp){
            //cout<<v[i].first<<" "<<v[i].second<<endl;
            tmp=v[i].first-1;
            ans++;
        }
    }
    
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int tsum = 0;
			int hsum = 0;
			for(int i=0; i<n; i++) {
				String taro = sc.next();
				String hanako = sc.next();
				
				if(taro.equals(hanako)) {
					tsum++;
					hsum++;
				}else if(taro.compareTo(hanako) > 0) {
					tsum += 3;
				}else {
					hsum += 3;
				}
				
			}
			System.out.printf("%d %d",tsum,hsum);
			System.out.println("");
			
		}
	}
}


Measured memory_bytes: 30236
if __name__ == "__main__":
    n, m = map(int, input().split())
    c = list(map(int, input().split()))
    c = sorted(c)

    dp = [[0] * (n + 1)] * m

    for i in range(n + 1):
        dp[0][i] = i
    
    for i in range(1, m):
        for j in range(n + 1):
            dp[i][j] = dp[i - 1][j]
            if j - c[i] >= 0:
                dp[i][j] = min(dp[i][j], dp[i][j - c[i]] + 1)
    print(dp[m-1][n])
        


Measured memory_bytes: 7516
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		long ans = 0;
		long money = 100;
		while(money < X){
			money = (long)(money * 1.01);
			ans++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 35808
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double a,b;
	cin>>a>>b;
	for(double i=1;i<=100000;i++)
	{
		int s=i*0.08;
		int t=i*0.1;
		if(s==a && t==b)
		{
			cout<<i;
			return 0;
		}
	}
	cout<<"-1";
	return 0;
 } 

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

int main(){

    int N, a[10000];
    cin >> N;
    for( int i = 0; i < N; i++ ) cin >> a[i];

    int sum = 0;
    for( int i = 0; i < N; i++ ){
        while( a[i]%2 == 0 ){
            sum++;
            a[i] /=2;
        }
    }
    
    cout << sum << endl;

    return 0;

}

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

int main() {
  int a, b;
  cin >> a >> b;

  // 両条件を満たす文字列を生成する
  // 文字列を数値に変換する
  // 両条件で生成された数値を比較し、大きい方をcoutする。
  
  string a_s = to_string(a);
  string b_s = to_string(b);
  
  string a_st, b_st;
  
  for(int i = 0; i < b; ++i) {
    a_st += a_s;
  }
  
  for(int i = 0; i < a; ++i) {
    b_st += b_s;
  }
  
  if(stoi(a_st) > stoi(b_st)) {
    cout << a_st << endl;
  } else {
    cout << b_st << endl;
  }
}


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

int main() {
  int N,K,a;
  cin >>N>>K;
  string S;
  cin>>S;
  vector<char> p(N+2);
  p.at(0)='c';
  p.at(N+1)='c';
  a=0;
  for(int i=1;i<=N;i++){
    p.at(i)=S.at(i-1);
    if(p.at(i-1)==p.at(i)||p.at(i)==p.at(i+1)){
      a++;
    }
  }
  cout <<min(a+2*K,N-1)<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define db(x) cout << "#x:" << x << endl
#define dd() cout << "Out put!\n"
const int mod=1e9+7,eps=1e-6,pi=acos(-1.0),maxn=1000010;
const int inf=0x7f7f7f7f7f7f7f7f;
using namespace std;
int a[maxn],b[maxn],c[maxn];
string s; 
signed main()
{
	int a;
	ld b;
	cin >> a >> b;
	cout << (int)(a*b)<<endl;
	return 0;
}

Measured memory_bytes: 3744
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int an = sc.nextInt();
		int bn = sc.nextInt();
		int mn = sc.nextInt();
		List<Integer> al = new ArrayList<>();
		List<Integer> bl = new ArrayList<>();

		int mina = Integer.MAX_VALUE;
		for (int i = 0; i < an; i++) {
			int temp = sc.nextInt();
			al.add(temp);
			if (mina > temp) {
				mina = temp;
			}
		}
		int minb = Integer.MAX_VALUE;
		for (int i = 0; i < bn; i++) {
			int temp = sc.nextInt();
			bl.add(temp);
			if (minb > temp) {
				minb = temp;
			}
		}
		int minm = Integer.MAX_VALUE;
		for (int i = 0; i < mn; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int c = sc.nextInt();
			int temp = al.get(x - 1) + bl.get(y - 1) - c;
			if (minm > temp) {
				minm = temp;
			}
		}
		System.out.println(Math.min(mina + minb, minm));
	}
}


Measured memory_bytes: 163384
#include <stdio.h>
typedef long long ll;

ll max(ll a, ll b) {
  return a > b ? a : b;
}

int main(void) {
  ll i, j, k, n;
  scanf("%lld", &n);
  ll dp[n + 1][n], p[n * 2];
  for(i = 0; i < n; ++i) {
    scanf("%lld", &p[i]);
    p[i + n] = p[i];
  }
  for(i = 0; i <= n; ++i) for(j = 0; j < n; ++j) dp[i][j] = 0;
  for(i = 1; i <= n; ++i) {
    if(i % 2) {
      for(j = 0; j < n; ++j) {
        ll t = j + 1;
        if(t >= n) t -= n;
        dp[i][j] = max(dp[i - 1][j] + p[i + j - 1], dp[i - 1][t] + p[j]);
      }
    } else {
      for(j = 0; j < n; ++j) {
        ll t = j - 1;
        if(t < 0) t += n;
        if(p[i + j - 1] >= p[t]) dp[i][j] = dp[i - 1][j];
        t = j + 1;
        if(t >= n) t -= n;
        if(p[i + j] <= p[j] && dp[i][j] < dp[i - 1][t]) dp[i][j] = dp[i - 1][t];
      }
    }
  }
  ll ans = 0;
  /*for(i = 1; i <= n; ++i) {
    for(j = 0; j < n; ++j) printf("%lld ", dp[i][j]);
    printf("\n");
  }*/
  for(i = 0; i < n; ++i) if(ans < dp[n][i]) ans = dp[n][i];
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 34036
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n, a[300000], maxn; vector<int>V;
int main() {
	cin >> n; for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 1; i <= n; i++) { if (n%i == 0)V.push_back(i); }
	for (int i = 0; i < V.size(); i++) {
		bool flag = true;
		for (int j = 0; j < n; j++) {
			if (a[j] != a[j%V[i]])flag = false;
		}
		if (flag == true)maxn = max(maxn, n / V[i]);
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 3936
#include <bits/stdc++.h>
using namespace std;
int main ()
{
	string s;
	cin >> s;
	for (int i =0; i<s.size() ; i++)
	{
		if (s[i] == '7'){
			cout << "Yes" << endl; 
			return 0;
			}
		}
		cout << "No" << endl;
	return 0;
}


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

int main(){
    int n; cin >> n;
    string s; cin >> s;
    int dp[300010][2]; // Eは0,Wは1に対応,i番目より前(iを含めない）でEが何個Wが何個
    for(int i = 2; i <= n+1; i++){
        if(s.at(i-2) == 'W'){
            dp[i][1] = dp[i-1][1]+1;
            dp[i][0] = dp[i-1][0];
        }
        else{
            dp[i][0] = dp[i-1][0]+1;
            dp[i][1] = dp[i-1][1];
        }
    }
    int ans = 1001001001;
    for(int i = 1; i <= n; i++){ //向きを変えるのはリーダーの左にあるWと右にあるE
        ans = min(ans, dp[i][1] + (dp[n+1][0] - dp[i+1][0]));
    }
    cout << ans << endl;
}

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

sys.setrecursionlimit(1000000)
n, m, *a = map(int, open(0).read().split())
dp = [1] + [-1] * n
dp[1] = 1
for i in a:
    dp[i] = 0

def count(n):
    if dp[n] != -1:
        return dp[n]
    dp[n] = (count(n - 1) + count(n - 2)) % (10**9 + 7)
    return dp[n]


print(count(n))


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

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

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
	char x, y;
	cin >> x >> y;

	if (x - y > 0)
	{
		cout << '>' << endl;
	}
	else if (x - y < 0)
	{
		cout << '<' << endl;
	}
	else
	{
		cout << '=' << endl;
	}

    return 0;
}

Measured memory_bytes: 256
import collections
N=int(input())
A=list(map(int,input().split()))
B=dict(collections.Counter(A))
a=0
Bk=B.keys()
for i in Bk:
    if i-1 in Bk:
        if i+1 in Bk:
            if a<B[i]+B[i-1]+B[i+1]:
                a=B[i]+B[i-1]+B[i+1]
        else:
            if a<B[i]+B[i-1]:
                a=B[i]+B[i-1]
    elif i+1 in Bk:
        if a<B[i]+B[i+1]:
            a=B[i]+B[i+1]
    else:
        if a<B[i]:
            a=B[i]
print(a)

Measured memory_bytes: 16096
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

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

const ll INF = 1e17;
const ll MOD = 1e9+7;

int main() {
    // input, ready, resolve
    string S,T,U;
    int s,t;
    cin >> S >> T;
    cin >> s >> t;
    cin >> U;

    if (S==U) s--;
    else t--;

    cout << s << " " << t << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int x[5];
  for(int i=0; i<5; i++)
  {
    cin>>x[i];
  }
  for(int j=0; j<5; j++)
  {
    if(x[j]==0)
    {
      cout<<j+1<<endl;
    }
  }
}
      

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

int main() {
	int N, A;
	string S;
	cin >> N;
    A = 0 ;
	for (int i = 0; i < N; i++) {
    	cin >> S;
    	if (S == "Y"){
            A = 1 ;
      		break;
    	}
    }
    if (A == 0){
 	cout << "Three" << endl; 
    }else{
    cout << "Four" << endl;
    }
}

Measured memory_bytes: 256
import math
a, b, x = map(int,input().split())
ans = 0

if a < b:
    ans = math.ceil(x/1000)* a
    print(ans)
elif a >= b*2:
    print(math.ceil(x/500)*b)
else:
    ans = (x // 1000)*a
    if (x % 1000) > 500:
        ans += a
    elif x % 1000 == 0:
        pass
    else:
        ans += b
    print(ans)


Measured memory_bytes: 5664