akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    string s;
    cin>>s;
    if(s[s.size()-1]=='s')
    {
        s+="es";
    }
    else
    {
        s+="s";
    }
    cout<<s<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 3644
H = int(input())

def func(H):
    # +1して半分にする
    if H == 1:
        return 1
    ans = 1
    # print("H/2:", int(H/2))
    ans += 2 * func(int(H/2))
    # print(f"at H: {H}, ans: {ans}")
    return ans

print(func(H))

Measured memory_bytes: 3060
// Problem Code: abc177_b

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int substring(string& S, string& T) {
	int m, n, min_cnt;
	m = S.length();
	n = min_cnt = T.length();
	
	for (int i = 0; i + n <= m; i++) {
		int cnt = 0;
		for (int j = 0; j < n; j++)
			cnt += (S[i + j] != T[j]);
		min_cnt = min(cnt, min_cnt);
	}
	
	return min_cnt;
}

int main() {
	string S, T;
	cin >> S >> T;
	cout << substring(S, T);
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define PI 3.1415926535897932384
#define MAX 100000
#define MOD 10000007
using namespace std;

///OMI
int main()
{
   string s;
   cin >> s;
   string s10 = s;
   reverse(s.begin(), s.end());
   int n = (s.size() - 1) / 2;
   int m = (s.size() + 3) / 2;

   string s1 = s.substr(0, n);
   string s2 = s.substr(m - 1, s.size());
   string s4 = s1;
   string s5 = s2;
   ///cout<<s2<<endl;

   ///cout<<s1<<endl;
   reverse(s1.begin(), s1.end());
   reverse(s2.begin(), s2.end());
   if (s4 == s1 && s2 == s5 && s == s10)
      cout << "Yes" << endl;
   else
      cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include<stdio.h>
#include<functional>
using namespace std;
typedef long long ll;
int main() {
    int a;
    int b;
    int c;
    int d;
    int e;
    int k;
    cin >> a >> b >> c >> d >> e >> k;
    int x;
    int y;
    int z;
    int w;
    x=e-a;
    y=e-b;
    z=e-c;
    w=e-d;
    if (x>k || y>k ||z>k ||w>k){
        printf(":(");
    }
    else{
        printf("Yay!");
    }
    // cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

void print_array(int *a, int n)
{
	for(int i = 0; i < n - 1; ++i)
	{
		printf("%d ", a[i]);
	}
	printf("%d\n", a[n-1]);
}

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

int main()
{
	int n, a[100];
	int cnt = 0;
	
	scan_array(a, &n);
	for(int i = 0; i < n; ++i)
	{
		int minj = i;
		for(int j = i + 1; j < n; ++j)
		{
			if(a[j] < a[minj])
			{
				minj = j;
			}
		}
		if(minj != i)
		{
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;

			++cnt;
		}
	}

	print_array(a, n);
	printf("%d\n", cnt);
}



Measured memory_bytes: 2112
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

const long long INF = (1LL << 60);

vector<long long> dijkstra(const vector<vector<pair<int,int>>>& g, int s){
	const int n = g.size();
	vector<long long> res(n, INF);
	priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> qu;
	qu.emplace(0, s);
	res[s] = 0;
	while(!qu.empty()){
		auto p = qu.top(); qu.pop();
		for(const auto& next : g[p.second]){
			int nextPos = next.second;
			long long nextDist = res[p.second] + next.first;
			if(res[nextPos] > nextDist){
				res[nextPos] = nextDist;
				qu.emplace(nextDist, nextPos);
			}
		}
	}
	return res;
}

int main(){
	int n, m, s, t;
	while(cin >> n >> m >> s >> t){
		--s; --t;
		vector<vector<pair<int,int>>> g1(n), g2(n);
		for(int i=0;i<m;i++){
			int u, v, a, b; cin >> u >> v >> a >> b;
			--u; --v;
			g1[u].emplace_back(a, v);
			g1[v].emplace_back(a, u);
			g2[u].emplace_back(b, v);
			g2[v].emplace_back(b, u);
		}
		auto dist1 = dijkstra(g1, s);
		auto dist2 = dijkstra(g2, t);
		vector<long long> res(n, INF);
		res[n-1] = dist1[n-1] + dist2[n-1];
		for(int i=n-2;i>=0;i--){
			res[i] = min(res[i+1], dist1[i]+dist2[i]);
		}
		for(auto& t : res) cout << 1000000000000000 - t << endl;
	}
}


Measured memory_bytes: 16184
#include<cstdio>
#include<vector>
using namespace std;
#define MAX 100000;

void DepthFirstSearch(int present_vertex, bool has_not_been_discovered[], vector<int> Adjacency_list[], int Group_number[], int group_number){
	int pv = present_vertex;
	has_not_been_discovered[pv] = false;
	Group_number[pv] = group_number;
	for(int i = 0;i < Adjacency_list[pv].size();++i){
		if(has_not_been_discovered[Adjacency_list[pv][i]]){
			DepthFirstSearch(Adjacency_list[pv][i], has_not_been_discovered, Adjacency_list, Group_number, group_number);
		}
	}
}

void DfsInit(int n, bool has_not_been_discovered[]){
	for (int i = 0; i < n; ++i)
		has_not_been_discovered[i] = true;
}

int main(){
	int number_of_users, number_of_friendships;
	scanf("%d %d", &number_of_users, &number_of_friendships);
	vector<int> Adjacency_list[number_of_users];
	for (int i = 0; i < number_of_friendships; ++i)	{
		int friend1, friend2;
		scanf("%d %d", &friend1, &friend2);
		Adjacency_list[friend1].push_back(friend2);
		Adjacency_list[friend2].push_back(friend1);
	}
	bool has_not_been_discovered[number_of_users];
	DfsInit(number_of_users, has_not_been_discovered);
	int Group_number[number_of_users];
	int group_number = 1;
	for (int user_i = 0; user_i < number_of_users; ++user_i){
		if(has_not_been_discovered[user_i])
			DepthFirstSearch(user_i, has_not_been_discovered, Adjacency_list, Group_number, group_number++);
	}
	int number_of_questions;
	scanf("%d", &number_of_questions);
	for (int i = 0; i < number_of_questions; ++i) {
		int user1, user2;
		scanf("%d %d", &user1, &user2);
		if(Group_number[user1] == Group_number[user2])
			printf("yes\n");
		else
			printf("no\n");
	}
	return 0;
}

Measured memory_bytes: 14808
#include <iostream>
#include <vector>
#include <list>
#include<utility>
#include <new>
#include <string>
#include<cmath>
#include<unordered_set>
#include<iomanip>
#include <stack>
#include<queue>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define loop(i,x,z) for (int i=x;i<z;i++)
using ll = unsigned long long int;
#define mod 1000000007
/*bool cmp(pair<ll,ll>a,pair<ll,ll>b){
return a.second<b.second;
}*/
int main() {
ll x,k,d;
cin>>x>>k>>d;
x=llabs(x);
if(d==1){
    if(x>=k){
        x=x-k;
        k=0;
    }else{
        k=k-x;
        x=0;
    }
}
while(k>0&&llabs(x)>d/2){
    k--;
    x=x-d;
}
if(k%2==0){
    cout<<llabs(x);
}else{
    x=min(llabs(x-d),llabs(x+d));
cout<<x;
}
        return 0;
}



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

/**
 * Created by sonetsuyoshi on 2016/07/31.
 */
public class Main {
    static int n;
    static int[] dif;
    static long mod = 1000000007;
    static public void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        dif = new int[n];

        for(int i = 0; i < n; i++) {
            dif[i] = sc.nextInt();
        }


        if(n % 2 == 0) {
            for(int i = 0; i < n; i++) {
                if(dif[i] % 2 == 0) {
                    System.out.println(0);
                    return;
                }
            }
        }

        if(n % 2 == 1) {
            for(int i = 0; i < n; i++) {
                if(dif[i] % 2 == 1) {
                    System.out.println(0);
                    return;
                }
            }
        }



        int[] box = new int[(n + 1) / 2];
        Arrays.fill(box, 2);
        if(n % 2 == 1) {
            box[0] = 1;
        }
        for(int d: dif) {
            box[d / 2] -= 1;
        }
        for(int b: box) {
            if(b != 0) {
                System.out.println(0);
                return;
            }
        }

        long ans = 1;
        for(int i = 0; i < n / 2; i++) {
            ans *= 2;
            ans %= mod;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 32324
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;



int main()
{
    fastInp;

    ll n;
    cin >> n;

    pair<ll, ll> pr = {0, 0};
    bool fl = true;

    ll prt = 0;

    for (int i = 0; i < n; i++) {
        ll x, y, t;
        cin >> t >> x >> y;
        ll ds = abs(pr.first - x) + abs(pr.second - y);

        if (ds > t - prt || ds % 2 != (t - prt) % 2) fl = false;
        pr = {x, y};
        prt = t;
    }

    if (fl) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
    int ar[100005],br[100005];

    cin>>n;
    f=0;
    while(n>0)
    {
        a=n%10;
        //cout<<a;
        if(a==7){cout<<"Yes"<<endl;f=1;break;}
        n=n/10;

    }
    //if(n==7 && f==0){cout<<"Yes"<<endl;f=1;}
    if(f==0){cout<<"No"<<endl;}






    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int n,p[500000],ans;
int main(){
    cin>>n;


        for (int i=0; i<n; i++) {
            cin>>p[i];
        }
        sort(p,p+n);
        ans=p[n/2]-p[(n/2)-1];
        if (ans<=0) {
           ans=0;
        }
  cout<<ans<<endl;
       
   
}


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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
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; }

ll power(ll x, ll y){//繰り返し2乗法
  if(y < 0){
    return 0;
  }else if(y == 0){
    return 1LL;
  }else if(y%2 == 0){//偶数
    return power(x,y/2)*power(x,y/2);
  }else{//奇数
    return power(x,y-1)*x;
  }
}

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int A, B; cin >> A >> B;
  
  //main
  for(int i=1; i<=3; i++){
    if(i == A || i == B){
      //cout << A << B << endl;
      continue; 
    }else{
      cout << i << endl;  
    }
  }
  
  // output
  
  return 0;
}

Measured memory_bytes: 256
while True:
    try:
        s = input()
        for i in range(27):
            ans = ""
            for j in range(len(s)):
                ch = s[j]
                if "a" <= ch <= "z":
                    ans += chr((ord(ch) - ord("a") + i)%26 + ord("a"))
                else:
                    ans += ch
            if "this" in ans or "that" in ans or"the" in ans:
                print(ans)
                break
    except:
        break



Measured memory_bytes: 5560
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()

int main() 
{
	// ios::sync_with_stdio(0);
	// cin.tie(0);
	// cout.tie(0);
	ll n,x,t;
	cin>>n>>x>>t;
	ll m = ceil((double)n/double(x));
	cout<<m*t;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll modp = 1000000007;
string s1, s2;
int main()
{
    int n;
    cin >> n >> s1 >> s2;
    ll ans, _ans;
    int i;
    if (s1[0] == s2[0])
    {
        ans = 3;
        _ans = 0;
        i = 1;
    }
    else
    {
        ans = 0;
        _ans = 6;
        i = 2;
    }
    while (i < n)
    {
        if (s1[i] == s2[i])
        {
            ans = (_ans + ans * 2ll % modp) % modp;
            _ans = 0;
            i++;
        }
        else
        {
            _ans = (2ll * ans % modp + 3ll * _ans % modp) % modp;
            ans = 0;
            i += 2;
        }
    }
    printf("%lld\n", (ans + _ans) % modp);
}

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

typedef long long ll;

ll N, M;
vector<vector<ll>> vec;
map<ll,ll> mapping;

int main(){
    cin >> N >> M;
    vec = vector<vector<ll>>(N,vector<ll>{});
    for(ll i = 0; i < M; i++){
        ll A, B;
        cin >> A >> B;
        A--, B--;
        vec[A].push_back(B);
        vec[B].push_back(A);
    }
    
    for(ll i = 0; i < N; i++){
        mapping[i] = -1;
    }
    
    queue<ll> sign;
    sign.push(0);
    while(!sign.empty()){
        ll temp = sign.front();
        sign.pop();
        for(int i = 0; i < vec[temp].size(); i++){
            if(mapping[vec[temp][i]] == -1){
                mapping[vec[temp][i]] = temp;
                sign.push(vec[temp][i]);
            }
        }
    }
    
    string res = "";
    for(int i = 1; i < N; i++){
        if(mapping[i] == -1){
            cout << "No" << endl;
            return 0;
        }
        res += to_string( mapping[i] + 1) + "\n";
    }
    cout << "Yes" << endl;
    cout << res;
    return 0;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 10005;

int n, m;
string dp[N];
int last[N];

int num[10] = {0,2,5,5,4,5,6,3,7,6};
int val[10];

bool comp(string a, string b) {
    if (sz(a) > sz(b)) return true;
    else if (sz(a) < sz(b)) return false;
    else {
        rep(i, 0, sz(a)) {
            if (a[i] > b[i]) return true;
            else if (a[i] < b[i]) return false;
        }
    }
    return true;
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
    cin >> n >> m;
    rep(i, 0, m) {
        int a; cin >> a;
        val[num[a]] = max(val[num[a]], a);
    }

    vi digits;
    rep(i, 0, 10) {
        if (val[i]) {
            digits.push_back(val[i]);
        }
    }

    rep(i, 0, n - 1) {
        if (i != 0 && sz(dp[i]) == 0) continue;
        for (auto j : digits) {
            if (j >= last[i] && i + num[j] <= n) {
                char si = '0' + j;
                string news = si + dp[i];
                if (comp(news, dp[i + num[j]])) {
                    dp[i + num[j]] = news;
                    last[i + num[j]] = j;
                }
            }
        }
    }


    cout << dp[n];
}


Measured memory_bytes: 53492
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		long N=stdIn.nextLong();
		long A[]=new long[5];
		int z=0,ir=1;
		while(z<5){
			A[z]=stdIn.nextLong();
			z++;
		}z=0;
		long y=N/A[0]+1,min=0,miny=N/A[0]+1;
		if(N%A[0]==0){
			y-=1;
			miny-=1;
		}
		min=A[0];
		while(z<5){
			if(A[z]<min){
				if(N%A[z]==0)
					ir=0;
				y+=N/A[z]+ir-miny;
				min=A[z];miny=N/A[z]+ir;
			}
			if(z!=0)
				y++;
			ir=1;
			z++;
		}
		System.out.println(y);
	}
}

Measured memory_bytes: 22100
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <utility>
#include <set>
#include <unordered_set>
#include <stack>
#include <iterator>
#include <random>
#include <fstream>
#include <chrono>
#include <math.h>
using namespace std;
#define int long long
int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // Нужно набрать один вроде
    int ans = 0;
    for(int i = 1 ; i <= 5; i++){
        int tt;
        cin >> tt;
        if(tt==0)
            ans = i;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3152
from math import hypot

def solve():
    N, K = map(int, input().split())
    xs, ys, cs = [], [], []
    for _ in range(N):
        x, y, c = map(int, input().split())
        xs.append(x)
        ys.append(y)
        cs.append(c)

    EPS = 10**-10
    def isLE(a, b):
        return not (a > b+EPS)

    def getIntersectionLCs(a, b, c, xC, yC, r):
        e = a*xC + b*yC + c
        ab2 = a**2 + b**2
        v = r**2 * ab2 - e**2
        if v < 0:
            return []
        elif v == 0:
            xP = xC + -a*e / ab2
            yP = yC + -b*e / ab2
            return [(xP, yP)]
        else:
            v = v**0.5
            ae, be = a*e, b*e
            av, bv = a*v, b*v
            xP1 = xC + (-ae + bv) / ab2
            yP1 = yC + (-be - av) / ab2
            xP2 = xC + (-ae - bv) / ab2
            yP2 = yC + (-be + av) / ab2
            return [(xP1, yP1), (xP2, yP2)]

    def getIntersectionCCs(x1, y1, r1, x2, y2, r2):
        xC, yC = x2-x1, y2-y1
        c = -(xC**2 + yC**2 + r1**2 - r2**2) / 2
        intCCs = getIntersectionLCs(xC, yC, c, 0, 0, r1)
        intCCs = [(x1 + x, y1 + y) for x, y in intCCs]
        return intCCs

    def countNum(xP, yP, xs, ys, rs, K):
        num = 0
        for i, (x, y, r) in enumerate(zip(xs, ys, rs), start=1):
            dist = hypot(x-xP, y-yP)
            if isLE(dist, r):
                num += 1
            if num >= K:
                return True
            elif num+N-i < K:
                return False
        return num >= K

    def isOK(t):
        rs = [t/c for c in cs]

        for xP, yP in zip(xs, ys):
            if countNum(xP, yP, xs, ys, rs, K):
                return True

        for i in range(N):
            x1, y1, r1 = xs[i], ys[i], rs[i]
            for j in range(i+1, N):
                x2, y2, r2 = xs[j], ys[j], rs[j]
                intCCs = getIntersectionCCs(x1, y1, r1, x2, y2, r2)
                for xP, yP in intCCs:
                    if countNum(xP, yP, xs, ys, rs, K):
                        return True

        return False

    ng, ok = 0, 2*10**5
    while abs(ok-ng) > 10**-7:
        mid = (ng+ok) / 2
        if isOK(mid):
            ok = mid
        else:
            ng = mid

    print(ok)


solve()


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


int main() {
    vector<vector<char>>data(2,vector<char>(3));
    rep(i,2){
        rep(j,3)cin>>data[i][j];
    }
    if(data[0][0]==data[1][2]&&data[0][1]==data[1][1]&&data[0][2]==data[1][0])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#ref. https://atcoder.jp/contests/abc129/submissions/5906191
import numpy as np
import sys

def main():
    sin = sys.stdin.buffer
    H, W = map(int, sin.readline().split())
    grid = np.frombuffer(sin.read(H * (W + 1)), dtype="B") == ord(".")
    grid = grid.reshape((H, W + 1))[:, :-1]

    L = np.empty((H, W), dtype="i4")
    R = np.empty((H, W), dtype="i4")
    T = np.empty((H, W), dtype="i4")
    B = np.empty((H, W), dtype="i4")

    T[0] = grid[0]
    for i in range(1, H):
        T[i] = (T[i - 1] + 1) * grid[i]

    B[-1] = grid[-1]
    for i in range(H - 2, -1, -1):
        B[i] = (B[i + 1] + 1) * grid[i]

    L[:, 0] = grid[:, 0]
    for i in range(1, W):
        L[:, i] = (L[:, i - 1] + 1) * grid[:, i]

    R[:, -1] = grid[:, -1]
    for i in range(W - 2, -1, -1):
        R[:, i] = (R[:, i + 1] + 1) * grid[:, i]

    ans = (T + B + L + R - 3).max()
    print(ans)

main()

Measured memory_bytes: 110056
//karna padega 
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n ;
		cin >> n ;
		cout << n + n* n + n*n* n;
	
	}
	return 0;
}

Measured memory_bytes: 3644
import numpy as np

N = int(input())
H = np.array(list(map(int, input().split())))
H[0] -= 1
for i in range(0, N - 1):
    diff = H[i + 1] - H[i]
    if diff >= 1:
        H[i + 1] -= 1
    elif diff < 0:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 23112
/**
 * File    : B2.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-11-16 08:54:22
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

ll X, Y, Z;

ll sum(int n)
{
  return n * Y + (n + 1) * Z;
}

int main()
{
  cin >> X >> Y >> Z;
  ll lb = 1, ub = 100010;
  while (ub - lb > 1)
  {
    ll t = (ub + lb) / 2;
    if (sum(t) <= X)
    {
      lb = t;
    }
    else
    {
      ub = t;
    }
  }
  cout << lb << endl;
}

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

int main() {
    long N, Q;
    string S;
    cin >> N >> Q >> S;
    vector <long> l(N), r(N);
    vector <long> ACGT_count(N, 0);
    rep(i, Q)
        cin >> l[i] >> r[i];

    rep(i, N - 1)
    {
        if(S[i] == 'A' && S[i + 1] == 'C')
            ACGT_count[i + 1]++;
    }
    cout << endl;
    rep(i, N -1)
        ACGT_count[i + 1] += ACGT_count[i];

    rep(i, Q)
    {
            cout << ACGT_count[r[i] - 1] - ACGT_count[l[i] - 1]  << endl;
    }
    return 0;  

}

Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

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

char grid[100][100];

void init(){
  rep(i,100){
    rep(j,100){
      if(i>=50)grid[i][j]='.';
      else grid[i][j]='#';
    }
  }
}

int main(){
  init();
  int a,b;
  cin>>a>>b;
  a--;b--;
  for(int i=1;i<50;i+=2){
    for(int j=1;j<100;j+=2){
      if(!a)break;
      grid[i][j]='.';
      a--;
    }
    if(!a)break;
  }

  for(int i=51;i<100;i+=2){
    for(int j=1;j<100;j+=2){
      if(!b)break;
      grid[i][j]='#';
      b--;
    }
    if(!b)break;
  }
  cout<<100<<" "<<100<<endl;
  rep(i,100){
    rep(j,100){
      cout<<grid[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*------------------------Original Copyright belongs to-------------------------/
!      																			!
!      ##  ##                                                		##  ##	    !
!      #   #             											#   #		!
!      				 ###  ####  ###   ###     ##         #                      !
!					#     #  #  #  #  #  #   #  #       ##                      !
!					#	  #  #  ###   ###    ####        #                      !
!					#     #  #  #  #  #  #   #  #        #                      !
!					 ###  ####  ###   #   #  #  #  ###  ### 			        !
!                                                                               !
/------------------------------------------------------------------------------*/
#include<bits/stdc++.h>
using namespace std;
//------------Template begins--------------------//
#define ss string
#define last(s) s.length()-1
#define lli long long int
#define ld long double
#define v(type) vector<type>
#define pr(type1,type2) pair<type1,type2>
#define ma(type1,type2) map<type1,type2>
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define L(i,start,end) for(lli i=start;i<=end;i++)
#define R(i,start,end) for(lli i=start;i>=end;i--)
#define inp(var,start,end,array) for(var=start;var<=end;var++) cin>>array[var];
#define whatIs(x) cout<<#x<<" is "<<x<<endl
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for (lli i=s1;i<=e1;i++) {cout<<i<<"th :"; for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}

lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
const lli LINF = 1e18;
const lli INF = 1e9;
const lli mod = 1e9+7;
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
 		lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); }
//---------------Template ends------------------//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
	//freopen("ip.txt","r",stdin);
	//freopen("op.txt","w",stdout);
	#endif
//#################### CATCH HERE ##########################
   	//* Uncomment if t test cases
	lli t=1;
	//cin>>t;
	while(t--)
	{
		lli n,val=100,ans=0,i,j;
		cin>>n;
		while(val<n)
		{
			lli x=val/100;
			val+=x;
			ans++;
		}
		cout<<ans<<endl;
	}
	//*/
	//cout<<ans<<endl;
//##########################################################
	return 0;
}

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

int main() {
    string aa, bb;
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= b; i++) aa += a + '0';
    for (int i = 1; i <= a; i++) bb += b + '0';
    if (aa < bb) {
        cout << aa << endl;
        return 0;
    } else {
        cout << bb << endl;
        return 0;
    }
    return 0;
}

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

int main(){
	bool p[10000000];
	p[0]=p[1]=false;
	for(int i=2;i<10000000;i++){
		p[i]=true;
	}
	for(int i=2;i*i<10000000;i++){
		if(p[i])
			for(int j=i*i;j<10000000;j+=i){
				p[j]=false;
			}
	}

	while(1){
		int N;
		cin>>N;
		if(N==0)
			break;
		for(int i=N;i!=0;i--){
			if(p[i-8]&&p[i-6]&&p[i-2]&&p[i]){
				cout<<i<<endl;
				break;
			}
		}

	}
	return 0;
}

Measured memory_bytes: 12776
#include <bits/stdc++.h>
using namespace std;
const int inf=1e3+9,mod=1e9+7;
string a[inf];
long long dp[inf][inf];
int main(){


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

    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++){
                if(a[i][j]=='#')
                    continue;
            if(i==0 || j==0 ){
                if( (i && dp[i-1][j]) || (j && dp[i][j-1])  || (i==0 && j==0))
                    dp[i][j]=1;
            }
            else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
        }
    cout<<dp[n-1][m-1];
}


Measured memory_bytes: 9216
object Main{
 def main(args: Array[String]): Unit = {
   val arr1 = io.StdIn.readLine().split(' ')
    val k = arr1(0).toInt
    val x = arr1(1).toInt
 
    for(i <- (k - 1) to -(k - 1) by -1){
      print(s"${x - i} ")
    }
 }
  
}

Measured memory_bytes: 25528
using System;
using System.Diagnostics;
using System.IO;

namespace AtCoder {
    class Practice {
        static void Main() => CustomMain();

        static void Solve() {
            var r = ReadInt();

            if (r < 1200) {
                WriteAnswer("ABC");
            } else if (r < 2800) {
                WriteAnswer("ARC");
            } else {
                WriteAnswer("AGC");
            }
        }

        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static string ReadString() => Console.ReadLine().Trim();
        static int ReadInt() => int.Parse(ReadString());
        static long ReadLong() => long.Parse(ReadString());
        static float ReadFloat() => float.Parse(ReadString());
        static double ReadDouble => double.Parse(ReadString());

        static string[] ReadStringArray() => ReadString().Split(' ');
        static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);

        static bool IsOdd(long num) {
            return (num & 1) == 1;
        }

        static bool IsEven(long num) {
            return (num & 1) == 0;
        }

        static long GCD(long a, long b) {
            return b != 0 ? GCD(b, a % b) : a;
        }
    }
}

Measured memory_bytes: 11092
N = int(input())
H = list(map(int, input().split()))
#N=3
#H=[2, 5, 4]

ans = 0
for i in range(N):
    c = 0
    #print(H[i])
    #print("a")
    for j in range(i):
        #print(H[i])
        #print("b")
        if H[i]>=H[j]:
            c += 1
            #print(c)
    if c == i:
        #print("c")
        ans += 1
print(ans)


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    int a;
    int t = 0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        t += a - 1;
    }

    cout << t << endl;
}


Measured memory_bytes: 256
n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]


def dist(a, b):
    sm = 0
    for ea, eb in zip(a, b):
        sm += (ea - eb) ** 2

    return sm ** 0.5


ans = 0
for i in range(n):
    for j in range(i + 1, n):
        dst = dist(x[i], x[j])
        for k in range(int(16000 ** 0.5) + 1):
            if k == dst:
                ans += 1
                break

print(ans)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL X, Y;

int main()
{
	in >> X >> Y;
	out << (abs(X - Y) >= 2 ? "Alice" : "Brown") << std::endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

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

		String s = sc.next();

		int count = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '1') {
				count++;
			}
		}

		System.out.println(count);

		sc.close();
	}

}




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

int main() {
  int n,x,y; cin >> n >> x >> y;
  vector<int> d(n);
  
  for(int i=1; i<n; i++){
    for(int j=i+1; j<=n; j++){
      int k = min(j-i, abs(x-i)+abs(y-j)+1);
      d[k]++;
      //cout << k << endl;
    }
  }
  for(int i=1; i<n; i++){
    cout << d[i] << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <time.h>

using namespace std;
typedef long long ll;

int N = 26;
int D;
ll c[26];
ll s[366][36];
int t[366];
set<int> st[26];

void input(){
    cin >> D;
    for(int i = 0; i < N; i++) {
        cin >> c[i];
        st[i].insert(0); st[i].insert(D+1);
    }
    for(int i = 1; i <= D; i++){
        for(int j = 0; j < N; j++) cin >> s[i][j];
    }
}


ll calc_score(){
    vector<int> last(N);
    ll S = 0;
    for(int d = 1; d <= D; d++){
        last[t[d]]  = d;
        for(int i = 0; i < N; i++){
            S -= c[i]*(d-last[i]);
        }
        S += s[d][t[d]];
    }
    return S;
}

ll calc_change(ll prev, int d, int q){
    prev -= s[d][t[d]]; prev += s[d][q];
    // t[d]がなくなる
    {
        auto l = st[t[d]].find(d); l--;
        auto r = st[t[d]].upper_bound(d);
        ll dif_l = d-*l, dif_r = *r-d;
        prev -= (dif_l)*(dif_r)*c[t[d]];
    }
    // qが増える
    {
        auto l = st[q].lower_bound(d); l--;
        auto r = st[q].upper_bound(d);
        ll dif_l = d-*l, dif_r = *r-d;
        prev += (dif_l)*(dif_r)*c[q];
    }
    return prev;
}

void change(int d, int q){
    st[t[d]].erase(d); st[q].insert(d);
    t[d] = q;
}

void output(){
    for(int i = 1; i <= D; i++) cout << t[i]+1 << endl;
}

void make_random_ans(){
    for(int i = 1; i <= D; i++){
        t[i] = rand()%N;
    }
}

void solve(){
    make_random_ans();
    clock_t start = clock();
    ll prev_sat = calc_score();
    while(true){     
        clock_t cur_time = clock();
        int d = (rand()%D)+1, q = (rand()%N);
        ll cur_sat = calc_change(prev_sat, d, q);
        if(cur_sat > prev_sat){
            prev_sat = cur_sat;
            change(d, q);
        }
        if((double)(cur_time-start)/CLOCKS_PER_SEC >= 1.5) break;
    }
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    input();
    solve();
    output();
}

Measured memory_bytes: 3776
/********************************************//**
 ****** Handle: techno_phyle    *****************
 ***********************************************/

#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define mod 1000000007
#define N 100010
#define M 200010
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto it:a) cout << it << " "; cout << endl
#define adbp(a) for(auto it:a) cout << it.first << " " << it.second << endl
#define pb push_back
#define mp make_pair
#define endline "\n"
#define in(x) scanf("%d",&x);
const ll INF = 1e18L + 5;
const int inf = 1e9 + 5;
typedef pair<double, long> key;
struct comp {
	bool operator()(pair<int, int> p1, pair<int, int> p2) {
		if (p1.first < p2.first) return false;
		if (p2.first < p1.first) return true;
		return p1.second < p2.second;
	};
};

int main() {
	fastIO;
	int test = 1 , j = 1;
	//cin >> test;
	while (test--) {
		int n;
		cin >> n;
		ll a[n];
		for (int i = 0; i < n; i++) cin >> a[i];
		ll pref[n];
		pref[n - 1] = a[n - 1];
		for (int i = n - 2; i >= 0; i--) pref[i] = pref[i + 1] + a[i];
		ll ans = 0;
		for (int i = 0; i < n - 1; i++) {
			ll val = ((a[i] % mod) * (pref[i + 1] % mod)) % mod;
			ans = (ans + val) % mod;
		}
		cout << ans << endl;

	}
	return 0;
}





Measured memory_bytes: 6728
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair<int,string> P;

static const double eps = 1e-8;

const int moveTo[][2] = {{-1,1},{0,1},{1,1}};

int stage[17][17];
int dp[17][17];

int main(){
	int w,h;
	while(~scanf("%d %d",&w,&h)){
		if(w==h && h==0) break;
		memset(stage,-1,sizeof(stage));
		memset(dp,0,sizeof(dp));
		for(int y=0;y<h;y++){
			for(int x=0;x<w;x++){
				scanf("%d",&stage[y][x]);
			}
		}

		//space:0 tree:1 jump:2
		for(int x=0;x<w;x++){
			if(stage[0][x]!=1) dp[0][x] = 1;
		}

		for(int dy=1;dy<=h;dy++){
			for(int dx=0;dx<w;dx++){
				if(stage[dy][dx] != 1){			
					for(int j=0;j<3;j++){
						int sx = dx - moveTo[j][0];
						int sy = dy - moveTo[j][1];
						if(sx < 0 || sx >= w || sy < 0 || sy >= h-1) continue;

						//space:0 tree:1 jump:2
						if(stage[sy][sx]!=0) continue;
						if(stage[dy][dx]==2 && dx != sx) continue;

						dp[dy][dx] += dp[sy][sx];
					}

					int sx = dx;
					int sy = dy-2;
					if(sx >=0 && sx < w && sy >= 0 && sy < h-1){
						//space:0 tree:1 jump:2
						if(stage[sy][sx] == 2){
							dp[dy][dx] += dp[sy][sx];
						}
					}
				}
			}
		}

		int res=0;
		for(int y=h-1;y<=h;y++){
			for(int x=0;x<w;x++){
				res += dp[y][x];
			}
		}

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

}

Measured memory_bytes: 0
#include<iostream>
#include<cmath>

using namespace std;
int main(int argc, char *argv)
{
    long double a,b,c;
    cin>>a>>b>>c;
    if(a+b+2*sqrt(a*b) < c)
    {
        cout<<"Yes"<<"\n";
    }
    else
    {
        cout<<"No"<<"\n";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  vector<int> rev(N);
  for (int i = 0; i < N; i++)
    rev[A[i] - 1] = i + 1;
  for (int i = 0; i < N; i++)
    cout << rev[i] << endl;
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int main()
{
 string S;
 cin>>S;
 if(S=="Sunny")S="Cloudy";
 else if(S=="Cloudy")S="Rainy";
 else if(S=="Rainy")S="Sunny";
 else{cout<<"Not Available";}
 cout<<S;
 return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
const int mod = 1e9+7;
#define maxn 5005
std::vector<int>E[maxn];
int n,p[maxn],vis[maxn],c[maxn],v[maxn],fac[maxn],f[maxn][maxn],tl,cnt,flg,ans,sum;
void dfs(int u){
	if(p[u]==-1)flg=1;
	cnt++;vis[u]=1;
	for(int v:E[u])if(!vis[v])dfs(v);
}int qpow(int a,int b){
	if(b==0)return 1;
	ll d=qpow(a,b>>1);d=d*d%mod;
	if(b&1)d=d*a%mod;
	return d;
}
int main(){
	scanf("%d",&n);
	fac[0]=1;for(int i=1;i<=n;++i)fac[i]=(ll)fac[i-1]*i%mod;
	for(int i=1;i<=n;++i){
		scanf("%d",&p[i]);
		if(p[i]==-1)continue;
		E[i].push_back(p[i]);
		E[p[i]].push_back(i);
	}for(int i=1;i<=n;++i){
		if(!vis[i]){
			cnt=0;flg=0;
			dfs(i);
			c[++tl]=cnt;v[tl]=flg;sum+=flg;
			
		}
	}
	f[0][0]=1;
	for(int i=1;i<=tl;++i)
		for(int j=0;j<=tl;++j)
			f[i][j]=(f[i-1][j]+((v[i]&&j)?((ll)f[i-1][j-1]*c[i]%mod):0))%mod;
	for(int i=1;i<=sum;++i)
		ans=(ans+(ll)(f[tl][i]-(i==1)*sum+mod)%mod*(ll)fac[i-1]%mod*qpow(n-1,sum-i)%mod)%mod; 
	printf("%lld",((ll)qpow(n-1,sum)*(n-(tl-sum))%mod-ans+mod)%mod);
	return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
bool isACGT(char ch) {
    return ch == 'A' || ch == 'T' || ch == 'C' || ch == 'G';
}

/*MAIN==================================================*/
signed main(){
    double START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    string s; cin >> s;
    i32 len = 0;
    for(i32 li = 0, ri = 0; ri < s.size(); ) {
        if(isACGT(s[li]) && isACGT(s[ri])) {
            chmax(len, ri-li+1);
            ++ri;
        }
        else ++li;
        if(ri < li) ri = li;
    }

    cout << len << '\n';

//     printf("ElapsedTime: %5.3f ms\n",1000*((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3632
N, K = map(int, input().split())
logs = list(map(int, input().split()))

l, r = 0, int(1e9)

def count_cut(log, size):
    return (log - 1) // size

while r - l > 1:
    pivot = (r + l) // 2
    count = sum(count_cut(log, pivot) for log in logs)

    if K < count:
        l = pivot
    elif count <= K:
        r = pivot

print(r)

Measured memory_bytes: 30836
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 100005;
inline int getint() {
    int r = 0; bool b = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') b = false; c = getchar(); }
    while (c >= '0' && c <= '9') { r = (r<<1)+(r<<3) + c - '0'; c = getchar(); }
    return b ? r : -r;
}
int cnt[2][MAXN];
int mx[2];
int ans, n;
int main() {
    n = getint();
    for (int i = 0; i < n; ++i) {
        ++cnt[i&1][getint()];
    }
    for (int i = 0; i <= 100000; ++i) {
        if (cnt[0][mx[0]] < cnt[0][i]) mx[0] = i;
        if (cnt[1][mx[1]] < cnt[1][i]) mx[1] = i;
    }
    for (int i = 0; i <= 100000; ++i) {
        if (mx[0] != i) ans = max(ans, cnt[0][mx[0]] + cnt[1][i]);
        if (mx[1] != i) ans = max(ans, cnt[1][mx[1]] + cnt[0][i]);
    }
    printf("%d", n - ans);
}


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

int main() {
	long long n, r = 0; cin >> n;
	if(n & 1) return cout << 0, 0;
	n /= 2;
	while(n) {
		n /= 5;
		r += n;
	}
	cout << r;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

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

int gcd(vector<int>a) {
  int ans = a[0];
  for (int i=1; i<sz(a); i++) {
    ans = gcd(ans, a[i]);
  }
  return ans;
}

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int ans = gcd(a);

    cout << ans << endl;
}

Measured memory_bytes: 1152
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,k,a[100002];
long long s1[100002],s2[100002],s,ans;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		s1[i]=s1[i-1]+a[i];
		s2[i]=s2[i-1]+max(0,a[i]);
	}
	ans=max(s1[n]-s1[n-k],0ll)+s2[n-k];
	for(int i=n;i>k;i--)
	{
		s+=max(0,a[i]);
		ans=max(ans,s2[i-k-1]+max(s1[i-1]-s1[i-k-1],0ll)+s);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int i,j;
  bool d[10]={};
  for(i=0;i<k;i++){
    cin >> j;
    d[j]=true;
  }
  string s;
  bool f;
  char c[10];
  for(i=0;i<10;i++) c[i]='0'+i;
  for(i=n;i<n*100;i++){
    stringstream ss;
    ss << i;
    s=ss.str();
    f=true;
    for(j=0;j<10;j++){
      if(d[j]&&s.find(c[j])!=-1){
	f=false;
	break;
      }
    }
    if(f){
      cout << i << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256