akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
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 (a>b) { a=b; return 1; } return 0; }
template<class T>void out(T a){cout << a << endl;}
template<class T>void die(T a){cout << a << endl; exit(0);}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}

ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(0);
    
	int A,B;cin>>A>>B;
	cout << A*B<<endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(){
    int n,i,j,swapCount=0;
    scanf("%d", &n);
    int a[n];
    for(i=0;i<n;i++) scanf("%d", &a[i]);
    for(i=0;i<n;i++){
        for(j=n-1;j>i;j--){
            if(a[j]<a[j-1]){
                a[j]^=a[j-1];
                a[j-1]^=a[j];
                a[j]^=a[j-1];
                swapCount++;
            }
        }
    }
    for(i=0;i<n-1;i++) printf("%d ",a[i]);
    printf("%d\n", a[i]);
    printf("%d\n", swapCount);
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int k;
  cin >> s>>k;
  for(int i=0;i<k;i++){
    if((s.at(i))!='1'){
      cout << s.at(i) << endl;
      return 0;
    }
  }
  cout << 1 << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  	int count = 0;
	int n,d;
 	cin >> n >> d;
  	vector<vector<double>> data(n, vector<double>(2));
 
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> data.at(i).at(j);
    }
  }
  for (int i = 0; i < n; i++) {
    if(sqrt(data.at(i).at(0)*data.at(i).at(0)+data.at(i).at(1)*data.at(i).at(1)) <= d) count++;
    }
  cout << count << endl;
}

Measured memory_bytes: 14372
n=int(input())
a= [int(input()) for i in range(n)] 

a.sort()
ans=0
m=1

for i in range(1,n):
    if a[i-1] == a[i]:
        m+=1
    else:
        ans+=(m%2)
        m=1

ans+=(m%2)

print(ans)


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

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

    int x;
    cin >> x;

    if (x < 600)
        cout << 8 << "\n";
    else if (x < 800)
        cout << 7 << "\n";
    else if (x < 1000)
        cout << 6 << "\n";
    else if (x < 1200)
        cout << 5 << "\n";
    else if (x < 1400)
        cout << 4 << "\n";
    else if (x < 1600)
        cout << 3 << "\n";
    else if (x < 1800)
        cout << 2 << "\n";
    else
        cout << 1 << "\n";

    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
inline int read()
{
	int sum=0,p=1;char ch=getchar();
	while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
	if(ch=='-')p=-1,ch=getchar();
	while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
	return sum*p;
}

int main()
{
	ll S;
	cin>>S;
	ll x1=0,y1=0,x2,y2,x3,y3;
	y2=1e9;
	x3=(S+y2-1)/y2;
	ll rest=x3*y2-S;
	x2=1; y3=rest;
	printf("%lld %lld %lld %lld %lld %lld\n",x1,y1,x2,y2,x3,y3);
	return 0;
}



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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,m,a,memo[100001],ans,memomemo[100001],z;
map<int,int> M;

main() {
    cin >> n >> m;
    rep1(i,n) z+=i,memomemo[i] = z;
    rep(i,n) cin >> a,memo[i] = a;
    rep1(i,n-1) memo[i] += memo[i-1];
    rep(i,n) M[memo[i]%m]++;
    M[0]++;
    for(auto i : M) ans += memomemo[i.se-1];
    cout << ans << endl;
}


Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <time.h>
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) ((c).rbegin(),(c).rend())
//#define sort(v,n) sort(v,v+n)
#define ll long long
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
string s;
set<char> se1;

int main() {
	cin >> s;
	int n = s.length();
	for (int i = 0; i < n; i++) {
		se1.insert(s[i]);
	}
	if (n == se1.size()) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<chrono>
#define ll long long
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;

int main() {
	cin >> N >> M >> Q;
	vector<vector<int>>t(N + 1, vector<int>(N + 1, 0));
	vector<vector<int>>c(N + 1, vector<int>(N + 1, 0));
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		t[L][R]++;
	}

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			c[i][j] = t[i][j] + c[i - 1][j] + c[i][j - 1] - c[i - 1][j - 1];
		}
	}
	for (int x = 0; x < Q; x++) {
		int p, q;
		cin >> p >> q;
		cout << c[q][q] - c[p - 1][q] - c[q][p - 1] + c[p - 1][p - 1] << endl;
	}
}

Measured memory_bytes: 2944
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define N	    100001
#define rep(i,a,b)  for(int i=a;i<b;i++)
typedef long long ll;
vi a;
int cal(int d) {
	int ans = 0;
	for(int i : a) {
		ans += abs(i - d);
	}
	return ans;
}
void solve(){
	int n, k;
	cin>>n>>k;
	if(k == 1) {
		cout<<n<<endl;
		return;
	}
	vi v(n), pre(n);
	int m = INT_MAX;
	for(int  &i : v) {
		cin>>i;
		m = min(m, i);
	}
	int ind = n + k;
	for(int i  = v.size() - 1; i >= 0; i--) {
		pre[i] = ind;
		if(v[i] == m) 
			ind = i;
	}
	int curr = 0;
	int ans = 0;
	while(curr < n - 1) {
		if(pre[curr] - curr <= k && pre[0] <= curr) {
			curr += k;
		}
		else {
			curr += k - 1;
		}
		ans++;
	}
	cout<<ans<<endl;
}
int main() {
	int t;
//	cin>>t;
	t = 1;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int MaxN = 500000;
typedef long long LL;

LL n, all, m;

int pre[MaxN + 5], last[MaxN + 5], other[MaxN + 5];
int seq[MaxN + 5];
LL dis[MaxN + 5], cost[MaxN + 5];
bool Inque[600005];


void Build(int x, int y, LL w)
{
	pre[++all] = last[x];
	last[x] = all;
	other[all] = y;
	cost[all] = w;
}

void Bfs(int s)
{
	int head = 1, tail = 1, now, ed, dr;
	seq[tail] = s;
	for(int i = 1; i <= n; i++)
	{
		if(i == s) dis[i] = 0;
		else dis[i] = (LL)1 << 60;
	}
	Inque[s] = 1;
	while(head <= tail)
	{
		now = seq[head];
		ed = last[now];
		while(ed != -1)
		{
			dr = other[ed];
			if(dis[now] + cost[ed] < dis[dr])
			{
				dis[dr] = dis[now] + cost[ed];
				if(!Inque[dr])
				{
					Inque[dr] = 1;
					seq[++tail] = dr;
				}
			}
			ed = pre[ed];
		}
		Inque[now] = 0;
		head++;
	}
}


int main()
{
	all = -1;
	memset(last, -1, sizeof(last));
	scanf("%d", &n);
	for(int i = 1; i <= n - 1; i++)
	{
		int a, b;
		LL w;
		scanf("%d %d %lld", &a, &b, &w);
		Build(a, b, w);
		Build(b, a, w);
	}
	memset(seq, 0, sizeof(seq));
	memset(Inque, 0, sizeof(Inque));
	int a, b;
	scanf("%d %d", &a, &b);
	Bfs(b);
	for(int i = 1; i <= a; i++)
	{
		LL ans = 0;
		int x, y;
		scanf("%d %d", &x, &y);
		ans += dis[x];
		ans += dis[y];
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 14720
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define clr clear()
#define ins insert
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define cusmem(x,val) for(auto &i:x) i=val;
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);\
            cin.tie(NULL);\
            cout.tie(NULL);
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
typedef pair<ll,int>pli;
typedef vector<ll> vl;
typedef vector<pll> vpll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;
string impossible;

mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());

// const int N=6;
const int N=5e2+5;
const int M=1e4+5;
const int L=41;
int MOD=1e9+7;
ll n,m,k,i,j,d;
bool f0,f1,f2;
const int MAXN=2e3;
int main(){
    #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin); 
            freopen("output.txt","w",stdout);
    #endif
    fastio
    cout<<fixed<<setprecision(11);
    int tests=1;    
    // cin>>tests;
    for(int te=1;te<=tests;te++){
        string s;   cin>>s;
        if(s=="SSS")    cout<<0;
        else if(s=="RSS"||s=="SRS"||s=="SSR"||s=="RSR")   cout<<1;
        else if(s=="RRR")   cout<<3;
        else if(s=="RRS"||s=="SRR") cout<<2;
    }
    return 0;
}





Measured memory_bytes: 3640
#include <stdio.h>
#include <cmath>
#include <algorithm>

struct Point{
	int x,y;
};

void func(int m){

	Point point[m];

	int min_x = 10000000,min_y = 10000000;

	for(int i = 0; i < m; i++){
		scanf("%d %d",&point[i].x,&point[i].y);

		//?????????????????????????????¢???
		if(min_x > point[i].x && min_y > point[i].y){
			min_x = point[i].x;
			min_y = point[i].y;
		}else if(min_x == point[i].x && min_y > point[i].y){
			min_y = point[i].y;
		}else if(min_x > point[i].x && min_y == point[i].y){
			min_x = point[i].x;
		}
	}

	//??????????????¨??????????????????????¨??????????
	for(int i = 0; i < m; i++){
		point[i].x -= min_x;
		point[i].y -= min_y;
	}

	int n;

	scanf("%d",&n);
	Point picture[n],offset[n][n];

	for(int i = 0; i < n; i++){
		scanf("%d %d",&picture[i].x,&picture[i].y);
	}

	//????????????????¨????<i:?????????k????????????>
	for(int i = 0; i < n; i++){
		for(int k = 0;k < n; k++){
			offset[i][k].x = picture[k].x - picture[i].x;
			offset[i][k].y = picture[k].y - picture[i].y;
		}
	}

	bool Found;
	int offset_x = -1, offset_y = -1;

	for(int i = 0,k = 0; i < n; i++){ //???????????????
		for(k = 0; k < m; k++){ //???????????????
			Found = false;
			for(int col = 0; col < n; col++){
				if(offset[i][col].x == point[k].x && offset[i][col].y == point[k].y){
					Found = true;
					break;
				}
			}
			if(!Found)break;	//?????????????????????????????¨???????????????????????????????¨????????????????????????????
		}
		if(k == m){ //m???????????¨?????????????????£?????´???
			offset_x = picture[i].x-min_x;
			offset_y = picture[i].y-min_y;
			break;
		}
	}
	printf("%d %d\n",offset_x,offset_y);

}


int main(){
	int m;

	while(true){
		scanf("%d",&m);
		if(m == 0)break;

		func(m);
	}

	return 0;
}

Measured memory_bytes: 10404
#include <bits/stdc++.h>
using namespace std;
const int N=2005;
int read(){
	int x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
int n;
int a[N];
int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
vector <int> e[N],ans[N],id[N];
vector <int> Merge(vector <int> a,vector <int> b){
	vector <int> ans;
	ans.clear();
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	while (!a.empty()&&!b.empty())
		if (a.back()>b.back())
			ans.push_back(a.back()),a.pop_back();
		else
			ans.push_back(b.back()),b.pop_back();
	while (!a.empty())
		ans.push_back(a.back()),a.pop_back();
	while (!b.empty())
		ans.push_back(b.back()),b.pop_back();
	return ans;
}
int vis[N];
bool cmp(int x,int y){
	return a[x]<a[y];
}
void solve(int x){
	vis[x]=1;
	id[x].clear();
	for (auto y : e[x])
		if (!vis[y])
			id[x].push_back(y);
	sort(id[x].begin(),id[x].end(),cmp);
	ans[x].clear();
	for (auto y : id[x])
		if (!vis[y]){
			solve(y);
			ans[x]=Merge(ans[x],ans[y]);
		}
	reverse(ans[x].begin(),ans[x].end());
	ans[x].push_back(a[x]);
	reverse(ans[x].begin(),ans[x].end());
}
int main(){
	n=read();
	for (int i=1;i<=n;i++){
		a[i]=read();
		e[i].clear();
	}
	for (int i=1;i<=n;i++)
		for (int j=i+1;j<=n;j++)
			if (gcd(a[i],a[j])!=1){
				e[i].push_back(j);
				e[j].push_back(i);
			}
	for (int i=1;i<=n;i++)
		e[0].push_back(i);
	solve(0);
	reverse(ans[0].begin(),ans[0].end());
	ans[0].pop_back();
	reverse(ans[0].begin(),ans[0].end());
	for (auto y : ans[0])
		printf("%d ",y);
	return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int c = 0;
    for (int i = 0 ; i < n - 2; i++) {
        if(s.substr(i,3)=="ABC") {
            c++;
        }
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

int main()
{

    int k,s;
    while(scanf("%d%d",&k,&s)!=EOF)
    {
        int cnt=0;
        for(int i=0; i<=k; i++)
            for(int j=0; j<=k; j++)
            {
                int z=s-i-j;
                if(z>=0&&z<=k)
                    cnt++;
            }
        printf("%d\n",cnt);
    }
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;
 
void unko(bool x) {
	if (x) cout << "unko" << endl;
}
 
int main() {
    int N, M; cin >> N >> M;
    vector<int> K(N);
    vector<vector<int> > S(N), H(N);
	int sumK = 0;
    for (int i = 0; i < N; i++) {
        cin >> K[i];
		sumK += K[i];
        for (int k = 0; k < K[i]; k++) {
            int s, h; cin >> s >> h;
            S[i].push_back(s);
            H[i].push_back(h);
        }
    }
	unko(sumK == 2000 && M >= 200 * 0);
    double maxi = 0;
    for (int t = 0; t < N; t++) {
        vector<int> dp(M + 1, -INF);
        dp[M] = 0;
        for (int i = 0; i < N - 1; i++) {
            vector<int> _dp = dp;
            for (int j = 0; j <= M; j++) {
                int h = 0, v = 0;
                for (int k = 0; k < K[i]; k++) {
                    h += H[i][k];
                    v += S[i][k] * H[i][k];
                    if (v > j) break;
                    _dp[j - v] = max(_dp[j - v], dp[j] + h);
                }
            }
            dp = _dp;
        }
        for (int j = 0; j <= M; j++) {
            double h = dp[j], v = j;
            for (int k = 0; k < K[N - 1]; k++) {
                double dh = min((double)H[N - 1][k], v / S[N - 1][k]);
                h += dh; v -= S[N - 1][k] * dh;
            }
            maxi = max(maxi, h);
        }
        rotate(K.begin(), K.begin() + 1, K.end());
        rotate(S.begin(), S.begin() + 1, S.end());
        rotate(H.begin(), H.begin() + 1, H.end());
    }
    printf("%.20f\n", maxi);
}

Measured memory_bytes: 1272
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    static int[][] minpath(int[][] c){
        int[][] path = c.clone();
        /*
        for(int i=0; i<c.length; i++){
            for(int j=0; j<c[0].length; j++){
                path[i][j] = Integer.MAX_VALUE;
            }
        }
        */

        for(int k=0; k<c.length; k++){
            for(int i=0; i<c.length; i++){
                for(int j=0; j<c.length; j++){
                    path[i][j] = Math.min(path[i][j], path[i][k]+path[k][j]);
                }
            }
        }
        return path;
    }

    static int minMF(int[][] c, int[][] A){
        int result = 0;
        int[][] minpath = minpath(c);
        for(int i=0; i<A.length; i++){
            for(int j=0; j<A[0].length; j++){
                if(A[i][j] == -1) continue;
                else result += minpath[A[i][j]][1];
            }
        }
        return result;
    }

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] inputstr = br.readLine().trim().split(" ");
        int[][] A = new int[Integer.parseInt(inputstr[0])][Integer.parseInt(inputstr[1])];
        int[][] c = new int[10][10];
        for(int i=0; i<c.length; i++){
            inputstr = br.readLine().trim().split(" ");
            for(int j=0; j<c[0].length; j++){
                c[i][j] = Integer.parseInt(inputstr[j]);
            }
        }
        for(int i=0; i<A.length; i++){
            inputstr = br.readLine().trim().split(" ");
            for(int j=0; j<A[0].length; j++){
                A[i][j] = Integer.parseInt(inputstr[j]);
            }
        }
        System.out.println(minMF(c, A));

    }
}

Measured memory_bytes: 25940
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    string s,s1,s2;
    int a,i;
    for(i=1; i<=n; i++)
    {
        cin>>a;
        s+=char(a+48);
    }
    for(i=1; i<=n; i++)
    {
        cin>>a;
        s1+=char(a+48);
    }
    for(i=1; i<=n; i++)
        s2+=char(i+48);
    int cnt=0,f=0,ff=0;
   // cout<<s<<" "<<s1<<" "<<s2<<endl;
    do
    {
        if(s2==s)
            ff=cnt;
        if(s2==s1)
            f=cnt;
        cnt++;
    }
    while(next_permutation(s2.begin(), s2.end()));
    cout<<abs(f-ff)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N, M; cin >> N >> M;
    if (N == M) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import numpy as np

def main():
    n = int(input())
    a = np.array(list(map(int, input().split())))
    b = np.array(list(map(int, input().split())))
    c = np.array(list(map(int, input().split())))
    res = np.sum(b)
    idx = a[:-1][np.diff(a) == 1]
    res += np.sum(c[idx - 1])
    print(res)

if __name__ == "__main__":
    main()


Measured memory_bytes: 14424
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;
const auto MOD = 1000000007;
const int INF = 1e9;
const long long LINF = 1e18;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef vector<int> VI;
typedef vector<long long> VLL;


int n, m;
string s;
bool is_prime[10000 + 1];
vector<int> P;
void Eratosthenes(const int N)
{
	for (int i = 0; i <= N; i++)
	{
		is_prime[i] = true;//初期化
	}
	for (int i = 2; i <= N; i++)
	{
		if (is_prime[i])
		{
			for (int j = 2 * i; j <= N; j += i)
			{
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
}

int main() {
	cin >> n;
	VI a(n+1);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i+1];
	}
	int cnt = 0;
	VI ans(n+1);
	for (int i = n; i > 0; i--)
	{
		if (2 * i <= n)break;
		ans[i] = a[i];
		if (a[i])cnt++;
	}
	//Eratosthenes(n);
	for (int i = n / 2; i > 0; i--)
	{
		bool temp = 0;
		for (int j = 2; j <= n; j++)
		{
			if (i*j > n)break;
			temp ^= ans[i*j];
		}
		ans[i] = temp ^ a[i];
		if (ans[i])cnt++;
	}
	cout << cnt << endl;
	for (int i = 0; i < n; i++)
	{
		if(ans[i+1])cout << i+1 << endl;
	}
}

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

void draw_card(map<string, int> &cards, int num, int increment) {
  for (int i = 0; i < num; i++) {
    string card;
    cin >> card;
    cards[card] = cards[card] + increment;
  }
}

int main() {
  map<string, int> cards;

  int N, M;
  cin >> N;
  draw_card(cards, N, 1);

  cin >> M;
  draw_card(cards, M, -1);

  int max_num = 0;
  for (auto itr = cards.begin(); itr != cards.end(); itr++) {
    max_num = max(max_num, itr->second);
  }

  cout << max_num << endl;
}



Measured memory_bytes: 3632
while True:
    n=int(input())
    if n==0:
        break
    i,min,max,a=0,1000,0,0
    while i<n:
        s=int(input())
        a+=s
        if min>s:
            min=s
        if max<s:
            max=s
        i+=1
    print((a-min-max)//(n-2))


Measured memory_bytes: 5600
import java.util.*;

class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int out = 0;
        for(int a = 1; a <= k; a++){
            for(int b = 1; b <= k; b++){
                for(int c = 1; c <= k; c++){
                    out += gcd(gcd(a, b), c);
                }
            }
        }
        System.out.println(out);
        scan.close();
    }
    
    int gcd(int a, int b){
        if(b == 0) return a;
        return gcd(b, a % b);
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 27272
n,h=map(int,input().split())
l=[]
for _ in range(n):
    a,b=map(int,input().split())
    l.append((a,b))
l.sort()
v=[]
for a,b in l[:-1]:
    if b>l[-1][0]:
        v.append(b)
v.sort(reverse=True)
#print(v)
#print(l)
ans=0
if l[-1][1]>=h:
    ans=1
    print(1)
    exit()
else:
    for i in v:
        h-=i
        ans+=1
        if h<=0:
            print(ans)
            exit()
        if l[-1][1]>=h:
            ans+=1
            print(ans)
            exit()
    h-=l[-1][1]
    ans+=1
    if h<=0:
        print(ans)
        exit()
    ans+=h//l[-1][0]
    if h%l[-1][0]:
        ans+=1
    print(ans)



Measured memory_bytes: 18312
package main

import (
	"fmt"
	"strconv"
	"strings"
)

var sum int

func main() {
	var s string
	fmt.Scan(&s)
	a := toSlice(s)
	p := make([]int, len(a)-1)

	if len(a) == 1 {
		fmt.Println(a[0])
		return
	}
	solve(a, 0, 1, &p)
	solve(a, 0, -1, &p)
	fmt.Println(sum)
}

func toSlice(s string) []int {
	var a []int
	for i := 0; i < len(s); i++ {
		a = append(a, toInt(string(s[i])))
	}
	return a
}

func solve(a []int, i int, b int, p *[]int) {
	if i == len(a)-1 {
		return
	}
	(*p)[i] = b
	if i == (len(a) - 2) {
		sum += getSum(genNum(a, p))
	}
	solve(a, i+1, 1, p)
	solve(a, i+1, -1, p)
}

func genNum(a []int, p *[]int) string {
	var s string
	for j := 0; j < len(a)-1; j++ {
		s += fmt.Sprintf("%d", a[j])
		if (*p)[j] == 1 {
			s += "+"
		}
	}
	s += fmt.Sprintf("%d", a[len(a)-1])
	return s
}

func getSum(s string) int {
	sum := 0
	for _, v := range strings.Split(s, "+") {
		sum += toInt(v)
	}
	return sum
}

func toInt(s string) int {
	i, err := strconv.Atoi(s)
	if err != nil {
		panic(err)
	}
	return i
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define llt long long int
#define pb push_back
#define pii pair<int,int>
#define mk make_pair
#define f first
#define s second
//int dp[100001];
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,w;
	cin>>n>>w;
	vector<pii>v(n);
	int x,y;
	for(int i=0;i<n;i++){
	    cin>>x>>y;
	    v[i].f=x;
	    v[i].s=y;
	}
	llt dp[n+1][w+1];
	memset(dp,0,sizeof dp);
	for(int i=1;i<=n;i++){
	    for(int j=1;j<=w;j++){
	        if(v[i-1].f>j){
	            dp[i][j]=dp[i-1][j];
	        }
	        else{
	            dp[i][j]=max(v[i-1].s+dp[i-1][j-v[i-1].f],dp[i-1][j]);
	        }
	    }
	}
	cout<<dp[n][w];
	return 0;
}

Measured memory_bytes: 79232
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (unsigned long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (unsigned long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end())
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 (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    char b;
    cin >> b;
    
    switch(b) {
        case 'A': cout << 'T' << endl; break;
        case 'T': cout << 'A' << endl; break;
        case 'G': cout << 'C' << endl; break;
        case 'C': cout << 'G' << endl; break;
    }
    
}

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

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;

#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

int main(){
    ll H;
    cin >> H;
    ll ms = 1;
    ll ret = 0;
    while(H > 0){
        ret += ms;
        if(H==1) break;
        H = ll(H/2);
        ms *= 2; 
    }
    cout << ret << endl;

    return 0;
}


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

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String strNum = "";
		ArrayList<String> squea = new ArrayList<String>();
		while (true) {
			strNum = br.readLine();
			if ("0 0".equals(strNum)) {
				break;
			}
			for (int i = 0; i < Integer.parseInt(strNum.split(" ")[0]); i++) {
				String line = "";
				for (int j = 0; j < Integer.parseInt(strNum.split(" ")[1]); j++) {
					line += "#";
				}
				squea.add(line);
			}
			squea.add("");
		}
		for (int i = 0; i < squea.size(); i++) {
			System.out.println(squea.get(i));
		}
	}

}

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

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int r;
signed main() {
    cin>>r;
    cout<<3*r*r<<endl;
}


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

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

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

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

int main() {
	int a, _, e, k;
	cin >> a >> _ >> _ >> _ >> e >> k;
	if(e - a <= k)
		cout << "Yay!" << endl;
	else
		cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int r, t;

	for (int i = 0; i < n; i++) {
		cin >> r >> t;
		if (r % 100 == 0) {
			if (t % 30 == 0) {
				cout << 5*(t/30)+(r/100) << endl;
			} else {
				cout << 5*(t/30)+(r/100) << ' ' << 5*((t/30)+1)+(r/100) << endl;
			}
		} else {
			if (t % 30 == 0) {
				cout << 5*(t/30)+(r/100) << ' ' << 5*(t/30)+(r/100)+1 << endl;
			} else {
				cout << 5*(t/30)+(r/100) << ' ' << 5*(t/30)+(r/100)+1 << ' ' << 5*((t/30)+1)+(r/100) << ' ' << 5*((t/30)+1)+(r/100)+1 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = int(input())
s = [0] * n
for i in range(n):
    s[i] = input()
cnt_st = Counter(s[0])
for i in range(1,n):
    memo = []
    cnt_tmp = Counter(s[i])
    for key in cnt_st.keys():
        if key in cnt_tmp.keys():
            cnt_st[key] = min(cnt_st[key], cnt_tmp[key])
        else:
            memo.append(key)
    for j in memo:
        cnt_st.pop(j)
# print(cnt_st)
ans = []
for key in cnt_st.keys():
    while cnt_st[key]:
        ans.append(key)
        cnt_st[key] -= 1
ans.sort()
print(''.join(ans))



Measured memory_bytes: 4324
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){return "";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var s = next();
  var len = s.length;
  var notXs = s.replace(/x/g,"");
  var tmpS = "";
  var count = 0;
  var list = [];
  for(var i = 0; i < len; i=(i+1)|0){
    if(s[i] != "x"){
      tmpS = s[i] + tmpS;
      list.push(count);
      count = 0;
    }else{
      count++;
    }
  }
  list.push(count);
  myerr(list);
  if(tmpS != notXs){
    myout(-1);
    return;
  }
  var output = 0;
  for(var i = 0; i < list.length; i=(i+1)|0){
    output += Math.abs(list[i] - list[list.length - 1 - i]);
  }
  myout(output / 2);
}


Measured memory_bytes: 54388
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    char s[11];
    int i,tmp,ans = 1000;
    scanf("%s",s);
    for(i=2;i<strlen(s);i++){
        tmp = abs((s[i-2]-'0')*100 + (s[i-1]-'0')*10 + (s[i]-'0')-753);
        if(tmp<ans) ans = tmp;
    }
    printf("%d",ans);
}


Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=100005;
ll k;
queue<ll>q;
ll solve() {
	for(int i=1; i<=9; i++) {
		q.push(i);
	}
	ll t,tt;
	while(k--) {
		t=q.front();
		q.pop();
		tt=t*10+t%10;
		if(t%10) {
			q.push(tt-1);
		}
		q.push(tt);
		if(t%10!=9) {
			q.push(tt+1);
		}
	}
	return t;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>k;
	cout<<solve();
	return 0;
}

Measured memory_bytes: 1792
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    s = sum(A)
    cnt = 0
    for a in A:
        if a * 4 * M >= s:
            cnt += 1
    
    if cnt >= M:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 65004
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N, T = map(int, input().split())
    A = list(map(int, input().split()))

    maxi, mini = [-1] * N, [INF] * N
    mini[0] = A[0]
    for i in range(1, N):
        mini[i] = min(mini[i - 1], A[i])
    maxi[-1] = A[-1]
    for i in range(N - 2, -1, -1):
        maxi[i] = max(maxi[i + 1], A[i])

    a, b = defaultdict(int), defaultdict(int)
    diff = -1
    for i in range(N):
        d1 = maxi[i] - A[i]
        d2 = A[i] - mini[i]
        diff = max(diff, d1, d2)
        a[d1] += 1
        b[d2] += 1

    print(min(a[diff], b[diff]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 32900
using System;
    using System.Collections.Generic;
    using static System.Console;
    using System.Linq;


class Program
{
    static void Main(string[] Args) {
        var list = new List<string>(ReadLine().Split(' ')).Select(ele => Int32.Parse(ele)).ToList();
        int Result = (int)Math.Min(Math.Floor(list[1] / (double)list[0]), list[2]);

        WriteLine(Result);

        ReadLine();
    }
}

Measured memory_bytes: 13396
/*****Here we go again!******/

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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define setbits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define sp(x) fixed << setprecision(10) << x
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

ld dp[3005][3005];
/**i == current index, j = no of heads till i**/

int main()
{
    fast;
    int n;
    cin >> n;
    dp[0][0] = 1;

    f(i,0,n)
    {
        ld p;
        cin >> p;
        f(j,0,i+1)
        {
            dp[i+1][j+1] += dp[i][j]*p;
            dp[i+1][j] += dp[i][j]*(1 - p);
        }
    }
    ld ans = 0;
    f(i,0,n+1)
    {
        if(2*i > n)
            ans += dp[n][i];
    }

    cout << sp(ans);
}


Measured memory_bytes: 85632
from itertools import combinations
inf = input().split()
N = int(inf[0])
K = int(inf[1])
if K > (N-1)*(N-2)//2:
  print(-1)
else:
  if K==(N-1)*(N-2)//2:
    print(N-1)
    for i in range(2,N+1):
      print(1,i)
  else:
    ls = [i for i in range(1,N+1)]
    ls = list(combinations(ls,2))
    dic = {x:0 for x in ls}
    for i in range(2,N+1):
      dic[(1,i)] = 1
    m = (N-1)*(N-2)//2
    while m>K:
      for x in ls:
        if dic[x]==0:
          dic[x]=1
          m-=1
          break
    ans = [i for i in dic.keys() if dic[i]==1]
    print(len(ans))
    for x in ans:
      print(x[0], x[1])


Measured memory_bytes: 4280
#include <stdio.h>
#include <string.h>
int main(void){
    int n,i;
    char y[4];
    double x,ans=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lf %s",&x,y);
        if(strcmp(y,"JPY")==0) ans+=x;
        else ans+=x*380000;
    }
    printf("%lf",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int r,c;cin>>r>>c;
	char grid[r][c];
	int dp[r][c];
	int MOD=pow(10,9)+7;
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
		{
			cin>>grid[i][j];
		}
	}
	for(int i=r-2;i>=0;i--)
	{
		dp[i][c-1]=1;
		if(grid[i][c-1]=='#')
		{
			for(int j=i;j>=0;j--)
			{
				dp[j][c-1]=0;
			}
			break;
		}
		
	}
		for(int i=c-2;i>=0;i--)
	{
		dp[r-1][i]=1;
		if(grid[r-1][i]=='#')
		{
			for(int j=i;j>=0;j--)
			{
				dp[r-1][j]=0;
			}
			break;
		}
		
	}
	for(int i=r-2;i>=0;i--)
	{
		for(int j=c-2;j>=0;j--)
		{
			if(grid[i][j]=='#')
			dp[i][j]=0;
			else 
			dp[i][j]=(dp[i][j+1]+dp[i+1][j])%MOD;
		}
	}
	cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 8460
fn read() -> (i32, i32, i32) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let vec: Vec<i32> = s
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    (vec[0], vec[1], vec[2])
}

fn main() {
    let (a, b, c) = read();
    if a <= c && c <= b {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include<cstdio>
using namespace std;
int main(){
long a,b,c=0,d=1,zc=0;
scanf("%ld",&a);
for(b=1;b<=a;b=b+2){
while(d<=b){if(b%d==0){c++;}d++;}
if(c==8){zc++;}
d=1;c=0;
}
printf("%ld",zc);
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>    
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()]
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N 	     = 1000*100+5;
const ll N2     = 1000*1000;
const double PI  = 3.14159265;
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;} 
int main()
{
	//comment for all except cc/cf
	/*	#ifndef ONLINE_JUDGE
    	freopen("input.txt","r",stdin);
    	freopen("out.txt","w",stdout);
   	 #endif*/
	fastio();
	int k,x;
	cin>>k>>x;
	for (int i = x-k+1; i <= x+k-1; ++i)
	{
		cout<<i<<" ";
	}
}

Measured memory_bytes: 256
#include<stdio.h>

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

    switch(D){
        case 22:

            printf("Christmas Eve Eve Eve");
            break ; 
        case 23 :
            printf("Christmas Eve Eve");
            break;
        case 24 :
            printf("Christmas Eve");
            break;
        case 25:
        printf("Christmas");
        break;
    }

}


Measured memory_bytes: 128
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
f=list(map(int,input().split()))
f=sorted(f,reverse=True)

def is_ok(b):
    m=0
    for p,q in zip(a,f):
        if p>b//q:
            m+=p-(b//q)
            if m>k:
                return False
    return True

ok=10**12+1
ng=-1
while ok-ng>1:
    m=(ok+ng)//2
    if is_ok(m):
        ok=m
    else:
        ng=m

print(ok)


Measured memory_bytes: 108492
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline--------------------------------------------
    a,b,c = map(int,input().split())
    print("Yes" if 4*a*b < (c-a-b)**2 and c > a+b else "No")
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 13708
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	          int N;
	          cin >> N;
	          int x=0,y=0;
	          for(i=1;i<=N;i++){
	        	  ll a;
	        	  cin >> a;
	        	  if(a%4==0) x++;
	        	  else if(a%2==0) y++;
	          }

	          if(2*x+1==N) cout << "Yes" << endl;
	          else if(2*x+y>=N) cout << "Yes" << endl;
	          else cout << "No" << endl;

	          return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 200001
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll h;

ll solve(ll h){
    if(h == 1) return 1;
    if(h > 1) return(2 * solve(h/2) + 1);
    return 0;
}

signed main(){
    cin >> h;
    cout << solve(h) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    i64 H;
    cin >> H;
    i64 w = 1;
    i64 ans = 0;
    while(H){
        H /= 2;
        ans += w;
        w *= 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int n;
	cin >> n;
	vector<ll> v(n);
	rep(i,n) cin >> v[i];
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += v[i] / 2;
		v[i] %= 2;
		if (i + 1 < n && v[i] != 0) {
			int x = min(v[i], v[i + 1]);
			ans += x;
			v[i] -= x;
			v[i+1] -= x;
		}
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 4052
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
INF = 1<<60

from bisect import bisect_right, bisect_left
def resolve():
    N = int(input())
    A = [int(input()) for _ in range(N)][::-1]

    dp = [INF]*(N+1)
    for a in A:
        ind = bisect_right(dp, a)
        dp[ind] = a

    ans = bisect_left(dp, INF)
    print(ans)

if __name__ == "__main__":
    resolve()

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

int gcd(int p, int q){
  int M,m; M=max(p,q); m=min(p,q);
  if(m==0){return M;}
  else{return gcd(m,M%m);}
}

int main(){
  int a,b,k; cin >> a >> b >> k;
  int c=0; int p=0;
  int g = gcd(a,b);
  
  while(c<k){
    p++;
    if(g%p==0){c++;}
  }
  
  cout << g/p;
  
  return 0;
}

Measured memory_bytes: 256