akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
using namespace std;


typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MAX = 1e5 + 10;

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

	vector<int> DP(MAX,INF);

	int N;
	cin >> N;

	vector<int> V(N);

	for(int i = 0; i < N; i++){
		cin >> V[i];
	}

	DP[0] = 0;

	for(int i = 0; i < N; i++){
		if(i + 1 < N) DP[i+1] = min(DP[i+1], DP[i] + abs(V[i+1] - V[i]));
		if(i + 2 < N) DP[i+2] = min(DP[i+2], DP[i] + abs(V[i+2] - V[i]));
	}

	cout << DP[N-1] << endl;


	return 0;
}


Measured memory_bytes: 3992
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		List<String> list = new ArrayList<String>();
		while(scan.hasNext()){
			double S_abc, S_pab, S_pac, S_pbc;
			double[] x = new double[3];
			double[] y = new double[3];
			
			for(int i = 0; i < 3; i++){
				x[i] = scan.nextDouble();
				y[i] = scan.nextDouble();
			}
			double xp = scan.nextDouble();
			double yp = scan.nextDouble();

			S_abc = 1.0 / 2.0 * Math.abs(x[0]*y[1] + x[1]*y[2] + x[2]*y[0]
				- y[0]*x[1] - y[1]*x[2] - y[2]*x[0]);
			S_pab = 1.0 / 2.0 * Math.abs(xp*y[0] + x[0]*y[1] +x[1]*yp
				- yp*x[0] - y[0]*x[1] - y[1]*xp);
			S_pac = 1.0 / 2.0 * Math.abs(xp*y[0] + x[0]*y[2] + x[2]*yp
				- yp*x[0] - y[0]*x[2] -y[2]*xp);
			S_pbc = 1.0 / 2.0 * Math.abs(xp*y[1] + x[1]*y[2] + x[2]*yp
				- yp*x[1] - y[1]*x[2] - y[2]*xp);

			String ans;
			if(S_abc == S_pab + S_pac + S_pbc){
				ans = "YES";
			} else{
				ans = "NO";
			}
			list.add(ans);
		}

		for(String s : list){
			System.out.printf("%s\n", s);
		}
	}
}

Measured memory_bytes: 32356
l = [3,5,7]

scan :: Int -> Int
scan n = iter (log10 n) where
    iter s
        | s < 3 = 0
        | otherwise = length ts + iter (s-1) where
            ts = filter (\e -> constraint e) (comb l s)
            constraint e = (all (\x -> elem x e) l) && (toN e <= n)

toN :: [Int] -> Int
toN = iter 0 where
    iter ac [] = ac
    iter ac (x:xs) = iter (ac*10 + x) xs        

log10 :: Int -> Int
log10 n = iter 0 1 where
    iter e x
        | x >= n = e
        | otherwise = iter (e+1) (x*10)

comb :: [a] -> Int -> [[a]]
comb xs 0 = [[]]
comb xs n = [x:y| x <- xs, y <- (comb xs (n-1))]   

main :: IO() 
main = do
    s <- readLn :: IO Int
    let ans = scan s
    print ans

Measured memory_bytes: 2300
#ifndef _WIN32
#include<iostream>
#endif

using namespace std;
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<string.h>


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

typedef vector<int> V;
typedef vector<V> VV;
template<typename T>
bool chmin(T &l, T r) {
	bool f = l > r; if (f)l = r; return f;
}
template<typename T>
bool chmax(T &l, T r) {
	bool f = l < r; if (f)l = r; return f;
}
int g[1 << 10];
int val[1 << 10];
int f(int sup) {
	if (val[sup] != -1)return val[sup];
	int &ret = val[sup];
	ret = 11;
	int sub = sup;
	do {
		if (g[sub])chmin(ret, f(sup - sub) + 1);
		sub = (sub - 1)&sup;
	} while (sub != sup);

	return ret;
}
int main() {
	int n; string s;
	while (cin >> n, n) {
		cin >> s;
		int bit = 0;
		VV e(10,V(1 << 10,0));
		REP(i, n) {
			if (s[i] == 'u')bit = 0;
			else {
				e[s[i] - '0'][bit] = 1;
				bit |= 1 << (s[i] - '0');
			}
		}

		bool ok = true;
		FOR(i, 1, 1 << 10) if(ok){
			REP(j, 1 << 10)g[j] = 0, val[j] = -1;
			val[0] = 0;
			REP(k, 10)if ((i >> k) & 1)REP(j, 1 << 10)g[j] |= e[k][j];
			if (f(i) <= 10) {
				//cout << i << endl;
				ok = false; break;
			}
		}
		if (ok)cout << "SAFE" << endl;
		else cout << "UNSAFE" << endl;
	}


}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

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

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int main()
{
    cout << fixed << setprecision(10);//小数点以下10桁出力
    ll a,b;
    cin >> a >> b;
    cout << lcm(a,b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100
#define INF 1e8
#define WHITE 0
#define GRAY  1
#define BLACK 2
 
int n,M[MAX][MAX];
 
void dijkstra(){
  int color[MAX],d[MAX],p[MAX],min,u;
  int i,j,v;
 
  for(i=0;i<n;i++){
    color[i] = WHITE;
    d[i] = INF;
  }
  d[0] = 0;
  p[0] = -1;
 
  while(1){
    min = INF;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<min){
    min = d[i];
    u = i;
      }
    }
 
    if(min == INF) break;
    color[u] = BLACK;
 
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v]!=INF){
    if(d[u]+M[u][v] < d[v]){
      d[v] = d[u] + M[u][v];
      p[v] = u;
      color[v] = GRAY;
    }
      }
    } 
  }
 
  for(i=0;i<n;i++) printf("%d %d\n",i,(d[i]==INF ? -1: d[i]));
}
 
int main(){
  int u,k,v,c;
  int i,j;
 
  scanf("%d",&n);
  for(i=0;i<n;i++) for(j=0;j<n;j++) M[i][j]=INF;
   
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      scanf("%d",&M[u][v]);
    }
  }
  dijkstra();
   
  return 0;
}



Measured memory_bytes: 2036
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

#pragma endregion

const int N = 100005;

int n;

pls give {
    AC;
    cin >> n;
    int a = 0;
    for (int i=1; i<=1000000; i++) {
        a = (a*10)+7;
        a %= n;
        if (a == 0) {
            cout << i << nl;
            return 0;
        }
    }
    cout << -1 << nl;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
typedef long long LL;

int main()
{
   string x; cin>>x;
   int su=0;
   for(int i=0;i<(int)x.size();i++)
	su+=x[i]-'0';
   if(su%9==0)
	cout<<"Yes"<<endl;
   else
	cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3752
N, M = map(int, input().split())
submit = [list(input().split()) for _ in range(M)]
acflag = [False]*N
AC = 0
waflag = [0]*N
WA = 0

for i in range(M):
    if (not acflag[int(submit[i][0])-1]) and submit[i][1] == "AC":
        acflag[int(submit[i][0])-1] = True
        AC += 1
    elif (not acflag[int(submit[i][0])-1]) and submit[i][1] == "WA":
        waflag[int(submit[i][0])-1] += 1

for i in range(N):
    if acflag[i]:
        WA += waflag[i]
print(AC, WA)

Measured memory_bytes: 27456
#include<iostream>
#define INT_MIN -2000000000
#define MAX_R 200001
using namespace std;

int main(){
	int n,k;
	while(cin >> n){
		int max=INT_MIN;
		int r[MAX_R];
		k=n;
		while(k--){
			cin >> r[k];
		}
		for(int i=0;i<n;i++){
			if(r[i]<max)continue;
			for(int j=i+1;j<n;j++){
				if(r[i]-r[j]>max)max=r[i]-r[j];
			}
		}
		cout << max << endl;
	}
	return 0;
}

Measured memory_bytes: 3816
//#define local
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
#ifdef local
#include "debug.cpp"
#else
#define debug(...)
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    ll H,W,m; cin >> H >> W >> m;
    set<P> s;
    vec<ll> h_num(H),w_num(W);
    rep(i,m){
        ll h,w; cin >> h >> w; --h; --w;
        h_num[h]++; w_num[w]++;
        s.insert(make_pair(h,w));
    }
    ll maxh=0,maxw=0;
    rep(i,H)maxh = max(maxh,h_num[i]);
    rep(i,W)maxw = max(maxw,w_num[i]);
    vec<ll> hh,ww;
    rep(i,H)if(h_num[i] == maxh)hh.emplace_back(i);
    rep(i,W)if(w_num[i] == maxw)ww.emplace_back(i);
    if(hh.size() * ww.size() > m){
        cout << maxh+maxw << endl;
        return 0;
    }
    rep(i,hh.size()){
        rep(j,ww.size()){
            if(!s.count(make_pair(hh[i],ww[j]))){
                cout << maxh+maxw << endl;
                return 0;
            }
        }
    }
    cout << maxh+maxw-1 << endl;

}

Measured memory_bytes: 34960
function main(input) {
    var a = input[0].split(" ")[0]-0;
    var b = input[0].split(" ")[1]-0;
    var c = input[0].split(" ")[2]-0;
    var d = input[0].split(" ")[3]-0;
  var l = a+b;
  var r = c+d;
  
    console.log(l==r?"Balanced":(l>r?"Left":"Right"));
    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))

Measured memory_bytes: 7372
N=int(input())
T=list(map(int,input().split()))
c=1
ans=0
for i,t in enumerate(T):
        try:
                if t==T[i+1]:
                        c+=1
                else:
                        ans+=c//2
                        c=1
        except:
                ans+=c//2
                pass
print(ans)

                

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,n;
	cin>>n;
	if(n==1){
		cout<<0;
		return 0;
	}
	vector<ll> vc;
	ll an=0;
	for(i=2;i*i<=n;i++){
		if(n%i==0){
			k=i-1;
			if((n/k)==(n%k)){
				an+=k;
			}
			if(i!=(n/i)){
				k=(n/i)-1;
				if((n/k)==(n%k)){
					an+=k;
				}
			}
		}
	}
	k=n-1;
	if((n/k)==(n%k)){
		an+=k;
	}
	cout<<an<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(auto i=a;i<n;i+=x)
#define forD(i,a,n,x) for(auto i=n-1;i>=0;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define init(a,x) memset(a,x,sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	string s,t; cin>>s>>t; ll ans=INT_MAX;
	ll n,m; n=s.length(); m = t.length();
	
	forA(i,0,n-m+1,1)
	{ 
		ll temp=0;
		forA(j,i,i+m,1)
		{
			if(s[j]!=t[j-i])temp++;
		}
		//cout<<temp<<"\n";
		ans=min(ans,temp);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

int run1(int H, int W, boost::multi_array<int, 2>const& data)
{
	typedef boost::multi_array<bool, 3> array_type;
	typedef array_type::extent_range range;
	array_type::extent_gen extent;
	const int shift = 12720;
	array_type dp(extent[H][W][range(-shift, shift + 1)]);
	dp[0][0][data[0][0]] = true;
	dp[0][0][-data[0][0]] = true;
	for (auto i : boost::irange(0, H))
	{
		for (auto j : boost::irange(0, W))
		{
			for (auto v : boost::irange(-shift, shift + 1))
			{
				if (!dp[i][j][v])
				{
					continue;
				}
				if (i + 1 != H)
				{
					dp[i + 1][j][v + data[i + 1][j]] = true;
					dp[i + 1][j][v - data[i + 1][j]] = true;
				}
				if (j + 1 != W)
				{
					dp[i][j + 1][v + data[i][j + 1]] = true;
					dp[i][j + 1][v - data[i][j + 1]] = true;
				}
			}
		}
	}
	for (auto v : boost::irange(0, shift + 1))
	{
		if (dp[H - 1][W - 1][v] || dp[H - 1][W - 1][-v])
		{
			return v;
		}
	}
	return shift + 1;
}

void Main()
{
	int H, W;
	std::cin >> H >> W;
	boost::multi_array<int, 2> data(boost::extents[H][W]);
	for (auto i : boost::irange(0, H))
	{
		for (auto j : boost::irange(0, W))
		{
			std::cin >> data[i][j];
		}
	}
	for (auto i : boost::irange(0, H))
	{
		for (auto j : boost::irange(0, W))
		{
			int b;
			std::cin >> b;
			data[i][j] -= b;
		}
	}
	
	std::cout << run1(H, W, data) << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 159360
N = int(input())

card1 = input()
card2 = card1.split()
card3 = card1.split()

for i in range(N-1):
  for j in range(N-1):
    if card2[N-1-j][1] < card2[N-2-j][1]:
      a = card2[N-1-j]
      b = card2[N-2-j]
      card2[N-2-j] = a
      card2[N-1-j] = b

print(" ".join(map(str,card2)))
print("Stable")

for i in range(N):
  minj = i
  for j in range(i,N):
    if card3[j][1] < card3[minj][1]:
      minj = j
  if not card3[i][1] == card3[minj][1]:
    a = card3[i]
    b = card3[minj]
    card3[i] = b
    card3[minj] = a

print(" ".join(map(str,card3)))


if card2 == card3:
  print("Stable")
else:
  print("Not stable")


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    int n,k,c;
    cin >> n >> k >> c;
    string st;
    cin >> st;
    int l[n]={0},r[n]={0};
    int p=0;
    for(int i=1;i<=k;i++){
        while(st[p]=='x')p++;
        l[p]=i;
        p+=c+1;
    }
    p=n-1;
    for(int i=k;i;i--){
        while(st[p]=='x')p--;
        r[p]=i;
        p-=c+1;
    }
    for(int i=0;i<n;i++)
        if(l[i] and l[i]==r[i])
            cout << i+1 << '\n';
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<pii, int> para;
const int inf = 1e9 + 7;
const int maxN = 1e6 + 5;

ll n, arr[maxN];

int main() {
	scanf("%lld",&n);
	REP(i, n) scanf("%lld",&arr[i]);
	ll ans = arr[0] / 2;
	arr[0] -= 2 * ans;
	RI(i, n - 1) {
		if (arr[i] > 0 && arr[i - 1] == 1) {
			ans++;
			arr[i]--;
		}
		ll x = arr[i] / 2;
		ans += x;
		arr[i] -= 2 * x;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> b(n);
    for(int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
    for(int i = 0; i < n; i++)
    {
        if(b[i] > i+1)
        {
            cout << -1 << endl;
            return 0;
        }
    }

    vector<int> ans;
    int x = n;
    while(x != 0)
    {
        bool flag = false;
        for(int i = n-1; i >= 1; i--)
        {
            if(b[i] == i+1)
            {
                ans.push_back(b[i]);
                for(int j = i; j < n-1; j++)
                {
                    b[j] = b[j+1];
                }
                flag = true;
                break;
            }
        }
        if(!flag)
        {
            ans.push_back(b[0]);
            for(int j = 0; j < n-1; j++)
            {
                b[j] = b[j+1];
            }
        }
        b[n-1] = 0;
        x--;
    }
    reverse(ans.begin(), ans.end());
    for(int i = 0; i < n; i++)
    {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;
vector<ll> A;
ll ans = INF;
map<l_l, vector<ll>> mp;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    A.resize(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    ll g = 0;
    for(int i = 2; i < N; i++) {
        g ^= A[i];
    }
    for(ll i = 0; i < (1 << 20); i++) {
        if(i >= A[0]) continue;
        ll A0 = A[0] - i;
        ll A1 = A[1] + i;
        ll nowg = A0 ^ A1 ^ g;
        ll mask = (1 << 20) - 1;
        if((mask & nowg) != 0) continue;
        A0 &= ~mask;
        A1 &= ~mask;
        mp[{A0, A1}].push_back(i);
    }
    for(auto tmp : mp) {
        /*
        cerr << tmp.first.first << " " << tmp.first.second << endl;
        cerr << tmp.second << endl;
        */
        if(tmp.second.size() > 2) {
            tmp.second.resize(2);
        }
        for(ll i = 0; i < (1 << 20); i++) {
            ll factor = i << 20;
            ll A0 = tmp.first.first - factor;
            ll A1 = tmp.first.second + factor;
            if(A0 < 0) continue;
            ll nowg = A0 ^ A1 ^ g;
            ll mask = (1 << 20) - 1;
            nowg &= ~mask;
            if(nowg != 0) continue;
            for(auto tmp2 : tmp.second) {
                ll nowans = factor + tmp2;
                if(nowans < A[0]) {
                    chmin(ans, nowans);
                }
            }
        }
    }
    if(ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(void)
{
	int n; scanf("%d",&n);
	printf("%d\n",a[n-1]);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];

    int max = 0;
    int index = 0;
    for (int i = 0; i < n; i++) {
        int cnt = 0;
        int num = h[i];
        for (int j = i+1; j < n && h[j] <= num; j++) {
            cnt++;
            num = h[j];
            i = j;
        }
        if (cnt > max) max = cnt;
    }
    
    cout << max << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define N 1000000007;

using namespace std;


int main()
{
  long long n,k;
  cin>>n>>k;
  if(n<=k)
   cout<<min(n,abs(n-k));
  else
   cout<<min(abs(n-(n/k)*k),abs(n-(n/k+1)*k));


}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

vector<vector<bool>> d;
vector<string> m;
int w, h;

void cal(ll x, ll y) {
	REP(i, 4) {
		ll nx = x + dx[i];
		ll ny = y + dy[i];
		if(nx >= 0 && nx < h && ny >= 0 && ny < w && m[nx][ny] == '.' && !d[nx][ny]) {
			d[nx][ny] = true;
			cal(nx, ny);
		}
	}
}

int main(void) {
	while(true) {
		cin>>w>>h;
		if(w == 0 && h == 0) break;
		m.resize(h);
		d.resize(h);
		REP(i, h) {
			d[i].resize(w);
			REP(j, w) {
				d[i][j] = false;
			}
		}
		REP(i, h) cin>>m[i];
		REP(i, h) {
			REP(j, w) {
				if(m[i][j] == '@') {
					d[i][j] = true;
					cal(i, j);
					break;
				}
			}
		}
		ll ans = 0;
		REP(i, h) {
			REP(j, w) {
				if(d[i][j]) ++ ans;
			}
		}
		cout<<ans<<endl;
	}
}

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

ll N,M;
ll a[100010];
string s;
int main(){
    cin>>N;
    ll mx=0;
    map<ll,ll> mp;
    vector<ll> v;
    for(ll i=0;i<N;i++){
        cin>>a[i];
        mp[a[i]]++;
        if(mp[a[i]]==1){
            v.push_back(a[i]);
        }
    }
    if(v.size()>3){
        cout<<"No"<<endl;
        return 0;
    }
    if(v.size()==2){
        if(mp[0]==0){
            cout<<"No"<<endl;
            return 0;
        }
        sort(v.begin(),v.end());
        if(mp[0]*2==mp[v[1]]){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
        return 0;
    }
    if(v.size()==1){
        if(mp[0]==0){
            cout<<"No"<<endl;
        }else{
            cout<<"Yes"<<endl;
        }
        return 0;
    }
    auto it=mp.begin();
    ll tmp=it->second;
    for(;it!=mp.end();it++){
        if(tmp!=it->second){
            cout<<"No"<<endl;
            return 0;
        }
    }
    sort(v.begin(),v.end());
    if((v[0]^v[1])==v[2]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

int main(){
  int a = 0;
  int c = 0;
  int N, A ,B;
  /*
  int N = 20;
  int A = 2;
  int B = 5;
   */
  cin >> N >> A >> B;
  for(int i=1;i<=N;i++){
    int b = 0;
    a = i;
    while(true){
      b += a % 10;
      a /= 10;
      if(a==0)break;
    }
    if(b<=B && b>=A){
      c += i;
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


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

int a,p;

cin >> a >> p;


cout << (a*3 + p)/2 << endl;




//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <stdio.h>

void seireki2wareki(int year_west, int month, int day);

int main(void)
{
    int year_west, month, day;
    while ((scanf("%d %d %d", &year_west, &month, &day)) != EOF){
        seireki2wareki(year_west, month, day);
    }

    return 0;
}

void seireki2wareki(int year_west, int month, int day)
{
    enum {PRE, MEIJI, TAISHO, SHOWA, HEISEI} gengou;
    int year_ja;

    if (year_west < 1868){
        gengou = PRE;
    } else if (year_west == 1868){
        if (month < 9){
            gengou = PRE;
        } else if (month == 9){
            if (day < 8){
                gengou = PRE; // pre_meiji ここまで
            } else {
                gengou = MEIJI;
                year_ja = 1;
            }
        } else {
            gengou = MEIJI;
            year_ja = 1;
        }
    } else if (year_west < 1912){
        gengou = MEIJI;
        year_ja = year_west - 1868 + 1;
    } else if (year_west == 1912){
        if (month < 7){
            gengou = MEIJI;
            year_ja = year_west - 1868 + 1;
        } else if (month == 7){
            if (day < 30){
                gengou = MEIJI;
                year_ja = year_west - 1868 + 1; // meiji ここまで
            } else {
                gengou = TAISHO;
                year_ja = 1;
            }
        } else {
            gengou = TAISHO;
            year_ja = 1;
        }
    } else if (year_west < 1926){
        gengou = TAISHO;
        year_ja = year_west - 1912 + 1;
    } else if (year_west == 1926){
        if (month < 12){
            gengou = TAISHO;
            year_ja = year_west - 1912 + 1;
        } else {
            if (day < 25){
                gengou = TAISHO;
                year_ja = year_west - 1912 + 1; // taisho ここまで
            } else {
                gengou = SHOWA;
                year_ja = 1;
            }
        }
    } else if (year_west < 1989){
        gengou = SHOWA;
        year_ja = year_west - 1926 + 1;
    } else if (year_west == 1989){
        if (month == 1){
            if (day < 8){
                gengou = SHOWA;
                year_ja = year_west - 1926 + 1; // showa ここまで
            } else {
                gengou = HEISEI;
                year_ja = 1;
            }
        } else {
            gengou = HEISEI;
            year_ja = 1;
        }
    } else {
        gengou = HEISEI;
        year_ja = year_west - 1989 + 1;
    }

    switch (gengou){
        case PRE:
            printf("pre-meiji\n");
            break;
        case MEIJI:
            printf("meiji ");
            break;
        case TAISHO:
            printf("taisho ");
            break;
        case SHOWA:
            printf("showa ");
            break;
        case HEISEI:
            printf("heisei ");
            break;
    }
    if (gengou != PRE){
        printf("%d %d %d\n", year_ja, month, day);
    }
}

Measured memory_bytes: 1036
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <fstream>
#include <string>
#include <map>
#include <queue>
#include <utility>
#include <stack>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

#define in cin
#define out cout

#define REP(i,n) for(int i=0; i<n; i++)
#define REP2(i,s,e) for(int i=s; i<e; i++)
#define REPE(i,s,e) for(int i=s; i<=e; i++)
#define REPR(i,s,e) for(int i=s; i>=e; i--)

#define all(v) v.begin(), v.end()
#define pb push_back

#define ll long long
#define pii pair<int, int>

#define x first
#define y second
#define intINF 2147483647
#define llINF 9223372036854775807LL
#define MOD 1000000007

int main()
{
    ll x; in >> x;
    ll r = 0;

    if(x > 0)
    {
        r += ((x-1) / 11)*2;
        x = (x-1+11)%11 + 1;

        if(x <= 6) r += 1;
        else r += 2;
    }

    out << r << endl;

    return 0;
}


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

int main(){
    
    int R,D,X;
    cin>>R>>D>>X;
    int res = 0;
    res = R*X - D;
    cout<<res<<endl; 
    for(int i = 1;i < 10;i++){
        res = R*res - D;
        cout<<res<<endl; 
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define pf push_front
#define ll long long
#define uxy pair<int, pair<int, int> >
using namespace std;
void TxtRead(){
    freopen("mootube.in","r", stdin);
    freopen("mootube.out","w", stdout);
}
void TheTime(){
    ios_base::sync_with_stdio(false);
	cin.tie();
}
const int N = 1e5+5;
const ll INF = 1e9+5;
const ll MOD = 1e9+7;
const double PI = 3.141592653589793116;

int n;
int cnt[2][N];
int mx[2][2], id[2][2];

int main()
{
    //TxtRead();
    TheTime();

    scanf("%d", &n);
    for(int i=0; i<n; i++){
        int a;
        scanf("%d", &a);
        cnt[i%2][a]++;
    }


    for(int k=0; k<=1; k++){
        for(int i=0; i<N; i++){
            if(cnt[k][i]>mx[k][0]){
                mx[k][1]=mx[k][0];
                id[k][1]=id[k][0];
                mx[k][0]=cnt[k][i];
                id[k][0]=i;
            }
            else if(cnt[k][i]>mx[k][1]){
                mx[k][1]=cnt[k][i];
                id[k][1]=i;
            }
        }
    }

    int ans;
    if(id[0][0]!=id[1][0]){
        ans=n-mx[0][0]-mx[1][0];
    }
    else{
        ans=min(n-mx[0][0]-mx[1][1], n-mx[0][1]-mx[1][0]);
    }

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







Measured memory_bytes: 1024
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.concurrency;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}
// fold was added in D 2.071.0.
template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
        static if (S.length < 2) {
            return reduce!fun(seed, r);
        } else {
            return reduce!fun(tuple(seed), r);
        }
    }
}

void main() {
    long N, X;
    readf("%d %d\n", &N, &X);
    writeln(3*(N-gcd(N, X)));
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>

//AOJ0080
#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

double q;
	
	while( cin >> q){
		if(q==-1 || cin.eof()) break;
		double x = q / 2;
		while(1){
			x = x - (x*x*x - q)/(3*x*x);
			if(abs(x*x*x-q) < 0.00001*q) break;
		}
		printf("%.6f\n",x);
	}
	return 0;
	
}

Measured memory_bytes: 1236
gets.to_i
array = readlines.map(&:chomp).map(&:to_i)
max_number = array.max
ary = array.clone
ary.delete(max_number)
secand_max = ary.max
if array.count(max_number) > 1
    array.size.times do
        p max_number
    end
else
    array.size.times do |order|
        if  array[order] == max_number
            p secand_max
        else
            p max_number
        end
    end
end


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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const unsigned int mod = 1e9 + 7;

using namespace std;

int32_t main() {
	fastio;

	int n, m;
	cin >> n >> m;
	int tot = 0;
	while(m--) {
		int x;
		cin >> x;
		tot += x;
	}
	if(tot <= n)
		cout << n - tot;
	else
		cout << -1;

	return 0;
}


Measured memory_bytes: 3648
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        Set<Integer> s = new HashSet<>();
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            if (!s.add(Integer.parseInt(scanner.next()))) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }

}



Measured memory_bytes: 68228
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(void){
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    unsigned int max_n = pow(2, n-1);
    ll min_cost = INF;
    for(unsigned int i=0; i<max_n; i++) {
        bitset<24> bs(i);
        if(bs.count() != k-1) continue;
        ll last = a[0];
        ll cost = 0;
        for(int j=0; j<n-1; j++) {
            if(!bs[j]) {
                last = max(last, a[j+1]);
                continue;
            }
            if(last >= a[j+1]) {
                last = last+1;
                cost += last - a[j+1];
            } else {
                last = a[j+1];
            }
        }
        min_cost = min(min_cost, cost);
    }

    cout << setprecision(12) << min_cost << endl;
    return 0;
}

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

int  main()
{
    string s;
    cin>>s;
    int cnt=0,idx=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='R')
        {
            cnt++;
            idx=max(idx,cnt);
        }
        else cnt=0;
    }
    cout<<idx<<endl;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int a;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.a = sc.nextInt();
    }
    
    //解答処理
    private int solve() {
        int answer = a + a*a + a*a*a;        
        return answer;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}


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

int main() {
	int n, k; cin >> n >> k;
	vector<int> a(n + 1), f(n + 1, 2e9); f[1] = 0;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 2; i <= n; i++)
	for (int j = 1; j <= min(i - 1, k); j++) {
		f[i] = min(f[i], f[i - j] + abs(a[i] - a[i - j]));
	}
	cout << f[n] << '\n';
}

Measured memory_bytes: 1024
/* Dedication has no limitation 
                   - Ulisses Jr.
*/
// 25 MAY  2019
// Location: Japan
#include <bits/stdc++.h>
using namespace std;

int main()
{int a,b;
 cin >> a >> b;
 if(a>=13){cout << b << endl;}
 if(a>=6 && a<=12){cout << b/2 << endl;}
 if(a<6){cout << 0 << endl;}
 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef pair<long long, long long>  pll;
const int MAX = 110000;

int n;
long long C;
vector<pll> x;

long long val1[MAX], val2[MAX];
long long sum1[MAX], sum2[MAX];

int main() {
    while (cin >> n >> C) {
        x.resize(n);
        for (int i = 0; i < n; ++i) cin >> x[i].first >> x[i].second;
        sort(x.begin(), x.end());
        
        long long res = 0;
        long long sum = 0;
        for (int i = 0; i < n; ++i) {
            sum += x[i].second;
            val1[i] = sum - x[i].first;
            if (i == 0) sum1[i] = sum - x[i].first;
            else sum1[i] = max(sum1[i-1], sum - x[i].first);
            chmax(res, sum - x[i].first);
        }
        
        sum = 0;
        for (int i = n-1; i >= 0; --i) {
            sum += x[i].second;
            val2[i] = sum - (C - x[i].first);
            if (i == n-1) sum2[i] = sum - (C - x[i].first);
            else sum2[i] = max(sum2[i+1], sum - (C - x[i].first));
            chmax(res, sum - (C - x[i].first));
        }
        
        // first jun
        for (int i = 0; i < n-1; ++i) {
            long long a = val1[i];
            long long b = sum2[i+1] - x[i].first;
            chmax(res, a + b);
        }
        
        for (int i = n-1; i > 0; --i) {
            long long a = val2[i];
            long long b = sum1[i-1] - (C - x[i].first);
            chmax(res, a + b);
        }

        cout << res << endl;
        
    }
}





























Measured memory_bytes: 4992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");
        String arr02[] = mylist.get(1).split(" ");

        String s1 = arr01[0];
        Integer n = Integer.valueOf(s1);

        BigDecimal bd[] = new BigDecimal[n];

        BigDecimal mysum = new BigDecimal("0");

        BigDecimal x = new BigDecimal("1");
        for (int i = 0; i < n; i++) {
            bd[i] = new BigDecimal(arr02[i]);

            BigDecimal temp = x.divide(bd[i], 10, BigDecimal.ROUND_FLOOR);
            mysum = mysum.add(temp);

        }

        BigDecimal result = x.divide(mysum, 10, BigDecimal.ROUND_FLOOR);

        System.out.println(result);

    }

}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int ans = 1;
  for (int i = 0; i < N; i++) {
    if (ans * 2 >= ans + K) ans += K;
    else ans *= 2;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

setrecursionlimit(10**7)

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

M = 10 ** 9 + 7

N = read()
S = input()

d = Counter(S)
ans = 1
for k, v in d.items():
  ans = ans * (v + 1) % M
print((ans - 1) % M)

Measured memory_bytes: 39408
N = int(input())
A = list(map(int, input().split()))

A.sort(key=lambda x: -x)

l = []

a_old = -1
for a in A:
    if a_old == a:
        l.append(a)
        a_old = -1
    else:
        a_old = a

l.append(0)
l.append(0)

print(l[0] * l[1])

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

int main(){
  int n,m,x,i=0;
  cin >> n >> m >> x;
  vector<int> a(n+1,0);
  for(int j=0;j<m;j++){
    cin >> i;
    a.at(i) = 1;
  }
  int sum1=0,sum2=0;
  for(int k=x;k<=n;k++){
    sum1 += a.at(k);
  }
  for(int k=x;k>=0;k--){
    sum2 += a.at(k);
  }
  cout << min(sum1,sum2);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char s[100000+1]={0}, tmp[26+1]={0};
  scanf("%s",s);
  for(int i=0; i<strlen(s); i++){
      tmp[(s[i]-'a')]++;
  }
  for(int i=0; i<26; i++){
    if( tmp[i]==0 ){ printf("%c\n", i+'a'); return 0; }  
  }
  printf("None\n");
  return 0;
}

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

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

  int sum = 0;
  for(int i=N; i>0; i/=10){
    sum += i % 10;
  }

  string res = "No";
  if(N % sum == 0){
    res = "Yes";
  }
  cout << res << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        int a = 0;
        int b = 0;
        String ans = "No";
        for(int i=0; i<=x; i++) {
            a = i;
            b = x-i;
            if(2*a+4*b == y) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35824
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
vector<int> c(26);
vector<vector<int>> s(365, vector<int>(26, 0));
vector<int> last(26, -1);
int main() {
    int d;
    cin >> d;
    for(int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    for(int i = 0; i < d; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int> t(d, -1);
    for(int i = 0; i < d; i++) {
        cin >> t[i];
        t[i]--;
    }
    int score = 0;
    for(int i = 0; i < d; i++) {
        last[t[i]] = i;
        score += s[i][t[i]];
        for(int j = 0; j < 26; j++) {
            score -= c[j] * (i - last[j]);
        }
        cout << score << endl;
    }
}

Measured memory_bytes: 3640
N, A, B = map(int, input().split())
S = list(input())
a, b = 0, 0
for i in range(N):
  if S[i] == 'a':
    if a + b < A+B:
      print('Yes')
      a += 1
    else:
      print('No')
  elif S[i] == 'b':
    if a + b < A+B and b < B:
      print('Yes')
      b += 1
    else:
      print('No')
  else:
    print('No')

Measured memory_bytes: 4712
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	ll n,m;
 	cin>>n>>m;
 	set<ll>st;
 	ll f[100005]={0};
 	ll cnt=0;
 	for(ll i=0;i<m;i++)
 	{
 		ll p;
 		string s;
 		cin>>p>>s;
 		if(s=="WA")
 		{
 			if(st.count(p)==0)
 			{
 				f[p]++;
 			}
 		}
 		else
 		{
 			st.insert(p);
 		}
 	}
 	for(auto x:st)
 	{
 		cnt+=f[x];
 	}
 	cout<<st.size()<<" "<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define int long long int
#define pb push_back
#define mk make_pair
#define flp(i, k, n) for(int i=k; i<n; i++)
#define rev(i, k) for(int i=k; i>=0; i--)
#define F first
#define S second
#define SIZE 100001
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};
int pre[SIZE];


int32_t main(void)
{
   int n;
   cin>>n;
   set<string> s;
   flp(i,0,n)
   {
      string u;
      cin>>u;
      s.insert(u);
   }
   
   cout<<s.size()<<"\n";
   return 0;
}

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

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

  ll ans = 0;
  REP(i, 0, N) {
    if (A[i] == B[i] && B[i] == C[i]) {
    } else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) {
      ans++;
    } else {
      ans += 2;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, T, ans;
int a[maxn];
int main()
{
	cin >> n >> T;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	int Min = a[1], Max = 0;
	for(int i = 1; i <= n; ++i)
	{
		Max = max(Max, a[i] - Min);
		Min = min(Min, a[i]);
	}
	Min = a[1];
	for(int i = 1; i <= n; ++i)
	{
		if(a[i] - Min == Max) ++ans;
		Min = min(Min, a[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4020
#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,c,k,i;
    scanf("%d %d",&a,&b);
    if(b < 10){
    c = a * 10+b;
    }
    else if(b < 100){
    c = a * 100 +b;
    }
    else if(b ==100 ){
    c = a * 1000 +b;
    }
    k = sqrt(c);
       if( c == k*k){
    printf("Yes");
    }
    else printf("No\n");

}


Measured memory_bytes: 128