akhauriyash/Code-Regression huggingface dataset:
f,g,h=range,max,input
R,C,K=map(int,h().split())
G=[[0]*-~C for i in f(R+1)]
for i in'_'*K:r,c,v=map(int,h().split());G[r][c]=v
F=[[[0]*-~C for i in f(R+1)]for i in f(4)]
for r in f(1,R+1):
	for x in f(1,4):
		for c in f(1,C+1):F[x][r][c]=g(F[x-1][r][c],F[x-1][r][c-1]+G[r][c],F[x][r][c-1],(x<2)*(G[r][c]+g(F[1][r-1][c],F[2][r-1][c],F[3][r-1][c])))
print(F[3][R][C])

Measured memory_bytes: 431016
n = int(input())
grid1 = list(map(int,input().split()))
grid2 = list(map(int,input().split()))
grid = [grid1, grid2]



result = [[0 for i in range(n)] for j in range(2)]

result[0][0] = grid[0][0]
#position0 +1で下に行く、position1 +1で右に行く
for i in range(1,n):
    result[0][i] = result[0][i-1] + grid[0][i]
result[1][0] = result[0][0] + grid[1][0]

position = [1,1]
for i in range(1,n):
    if result[0][i] < result[1][i-1]:
        result[1][i] = result[1][i-1] + grid[1][i]
    else:
        result[1][i] = result[0][i] + grid[1][i]

print(result[1][n-1])

Measured memory_bytes: 3064
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

using namespace std;

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



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

int main() {
  int N;
  cin >> N;
 // cout << N << endl;
  
  for (int i=0; i<N; i++){
    string c;
    cin >> c;
    
//    cout << c << endl;
    
    if ( c == "Y" ){
      cout << "Four" << endl;
      break;
    }
    if ( i == (N-1) ){
      cout << "Three" << endl;
    }
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;

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




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



set<int>st;
for(int i=0;i<3;i++)
{
  int x; cin>>x; st.insert(x);
}
if(st.size()==2)cout<<"Yes\n";
else cout<<"No\n";

  
}



Measured memory_bytes: 256
from collections import deque


def round_schedule(processes, q):
    queue = deque(processes)
    c_time = 0
    while len(queue) > 0:
        p_name, p_time = queue.popleft()
        res_time = p_time - q
        if res_time <= 0:
            c_time += p_time
            print(p_name, c_time)
        else:
            queue.append((p_name, res_time))
            c_time += q


if __name__ == "__main__":
    n, q = list(map(int, input().split()))
    processes = []
    for i in range(n):
        p_name, p_time = input().split()
        p_time = int(p_time)
        processes.append((p_name, p_time))
    
    round_schedule(processes, q)
    


Measured memory_bytes: 13968
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
from bisect import bisect_left
def resolve():
    n = int(input())
    A = list(map(int,input().split()))
    E = [[] for _ in range(n)]
    for _ in range(n - 1):
        u, v = map(int,input().split())
        u -= 1; v -= 1
        E[u].append(v)
        E[v].append(u)

    dp = [INF] * (n + 1)
    dp[0] = -INF
    res = 0
    ans = [None] * n
    change = [None] * n
    stack = [(0, -1)]

    while stack:
        v, p = stack.pop()
        if v >= 0:
            idx = bisect_left(dp, A[v])
            change[v] = (idx, dp[idx])
            res = max(res, idx)
            ans[v] = res
            dp[idx] = A[v]
            for nv in E[v]:
                if nv == p:
                    continue
                stack.append((~nv, v))
                stack.append((nv, v))
        else:
            v = ~v
            idx, prev = change[v]
            dp[idx] = prev
            res = ans[p]

    print(*ans)
resolve()

Measured memory_bytes: 147900
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
const double eps = 1e-10;
const int N=25;

struct point {
    double x,y,z;
}pt[N];
int n,m;
double dis[N][N];

double dist(point p1,point p2) {
    return (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z);
}

double ret;
int ans[N];
void dfs(int idx,int k,double sum) {
    if(k+(n-idx)+2<m) return;
    if(k==m) {
        ret=max(ret,sum);
        return;
    }

    dfs(idx+1,k,sum);
    double tmp=0;
    for(int i=0;i<k;i++) tmp+=dis[ans[i]][idx];
    ans[k]=idx;
    dfs(idx+1,k+1,sum+tmp);
}

int main()
{
    int i,j,t,cas=0;
    while(scanf("%d%d",&n,&m)!=EOF) {
        for(i=1;i<=n;i++) {
            scanf("%lf%lf%lf",&pt[i].x,&pt[i].y,&pt[i].z);
        }
        for(i=1;i<=n;i++) {
            for(j=1;j<=n;j++) {
                dis[i][j]=dist(pt[i],pt[j]);
            }
        }

        ret=0.0;
        dfs(1,0,0);

        printf("%.10f\n",ret);
    }
    return 0;
}

/*
20 10
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11
12 12 12
13 13 13
14 14 14
15 15 15
16 16 16
17 17 17
18 18 18
19 19 19
*/

Measured memory_bytes: 1100
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int gcd(int a, int b) {
	int x = a, y = b;
	while (x != y) {
		if (x > y) {
			x = x - y;
		} else {
			y = y - x;
		}
	}
	return x;
}

int main() {
	int a, b, c;
	cin >> a >> b >>c;
	int g = gcd(a, b);
	if (c % g == 0) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n[3],num;

	cin >> num;

	for(int i=0; i<3; i++){
		n[i] = num % 10;
		num /= 10;
	}

	if(n[0] == 7){
		cout << "Yes" << endl;
	}else if(n[1] == 7){
		cout << "Yes" << endl;
	}else if(n[2] == 7){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}



	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
typedef long long int ll;
// #define int long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FRE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define debug(x) cout << #x << " is: " << (x) << endl;
#define debugx(x) cout << #x << " is: " << (x) << endl; exit(0);
#define f(i,n) for(ll i=0;i<n;i++)
#define fa(i,a,n) for(ll i=a;i<n;i++)
#define loop(i,a, n) for(ll i = a; i <= n; i++)
#define loopb(i,a, n) for(ll i = a; i >= n; i--)
#define pb push_back
#define pf push_front
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define setmem(x, k) memset(x, k, sizeof(x))
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define MOD 1000000007
#define INF 1000111000111000111LL
#define endl "\n"
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<vector<ll>> matrix;
ll dx[] = {0, 1, 0, -1};
ll dy[] = {-1, 0, 1, 0};
const ll N = 3e4+5;
// ll a[N], b[N], dp[N], level[N], vis[N], in[N], out[N];
// vl g[N];
ll n, m;


void solve() {
    string s;
    cin >> n >> s;
    ll wc = 0, rc = 0;
    for(char x: s){
        if(x == 'W') wc++;
        else rc++;
    }
    if(wc == 0 || rc == 0){
        cout << 0 << endl;
        return;
    }
    ll twc = 0, trc = 0;
    f(i, rc){
        if(s[i] == 'R'){
            trc++;
        }
    }
    for(ll i = rc; i < n; i++){
        if(s[i] == 'W'){
            twc++;
        }
    }
    ll ans1 = rc - trc;
    ll ans2 = wc - twc;
    cout << min({ans1, ans2, wc, rc}) << endl;
}


int32_t main() {
    IOS
    solve();
    cerr<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<'\n';
    return 0;
}

Measured memory_bytes: 3964
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<Integer, Integer> tree = new TreeMap<Integer, Integer>();
		for(int i = 0; i < n; ++i)
		tree.put(sc.nextInt(), i + 1);
		sc.close();
		for(int i = 1; i <= n; ++i){
			System.out.print(tree.get(i) + " ");
		}
		System.out.println();
	}
}


Measured memory_bytes: 73248
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        String S = scanner.next();

        if (N < 1) {
            System.out.println(0);
            return;
        }

        char lastChar = S.charAt(0);
        int res = 1;
        for (int i = 1; i < N; i++) {
            if (lastChar == S.charAt(i)) {
                continue;
            } else {
                lastChar = S.charAt(i);
                res ++;
            }
        }
        System.out.println(res);
    }
}

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

using namespace std;

#pragma GCC optimize("Ofast")

int main(){
    long long int N;
    cin >> N;
    string S,T;
    cin >> S >> T;
    string H;
    for(long long int i=0;i<N;++i){
        H+=S[i];
        H+=T[i];
    }
    cout << H;
}

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

ll mod = 1000000007;

class SCC{
public:
	vector<vector<int> > G,rG,graph,bg;
	vector<int> vs,cmp;
	vector<bool> used;
	int V,cnt;
	SCC(int node_size){
		V = node_size;
		G.resize(V),rG.resize(V);
		used.resize(V),cmp.resize(V);
	}
	void add_edge(int from,int to){
		G[from].push_back(to);
		rG[to].push_back(from);
	}
	void dfs(int u){
		used[u] = true;
		for(int v : G[u]){
			if(!used[v]){
				dfs(v);
			}
		}
		vs.push_back(u);
	}
	void dfs(int u,const int k){
		used[u] = true;
		cmp[u] = k;
		for(int v : rG[u]){
			if(!used[v]){
				dfs(v,k);
			}
		}
	}
	int solve(){ //強連結成分の数を返す
		fill(used.begin(),used.end(),false);
		rep(i,V){
			if(!used[i]){
				dfs(i);
			}
		}
		fill(used.begin(),used.end(),false);
		cnt = 0;
		for(int i=V-1;i>=0;i--){
			if(!used[vs[i]]){
				dfs(vs[i],cnt++);
			}
		}
		return cnt;
	}
	void make_graph(){
		graph.resize(cnt);
        bg.resize(cnt);
		rep(i,V){
			for(int v : G[i]){
				if(cmp[i] != cmp[v]){
					graph[cmp[i]].push_back(cmp[v]);
					bg[cmp[v]].push_back(cmp[i]);
                }
			}
		}
	}
};

ll bfs(int i,vector<vector<int> > &g,vector<vector<int> > &bg){
    if(bg[i].size()==0){
        return (ll)2;
    }
    ll ans = 1;
    for(int v : bg[i]){
        ans = ans*bfs(v,g,bg)%mod;
    }
    return (ans+1)%mod;
}

int main(){
    int n,m;
    cin >> n >> m;
    SCC scc(n);
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        scc.add_edge(a,b);
    }
    int s = scc.solve();
    scc.make_graph();
    auto& g = scc.graph;
    auto& bg = scc.bg;
    ll ans = 1;
    for(int i=0;i<s;i++){
        if(g[i].size()==0){
            ans = ans*bfs(i,g,bg)%mod;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3324
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
using i64 = long long;
using namespace std;

const int mod = 998244353;

class ModInt {
public:
  int value;
  ModInt() : value(0) {}
  ModInt(int value) {
    this->value = normalize(value);
  }  
  ModInt operator+(ModInt const &other) {
    return ModInt(normalize(this->value + other.value));
  }
  ModInt& operator+=(const ModInt& other) {
      this->value = normalize(this->value + other.value);
      return *this;
}
  int normalize(i64 value) {
    while (value < 0) value += mod;
    value %= mod;
    return value;
  }
};

ostream& operator<<(ostream& os, ModInt const &m) {
  os << (m.value);
  return os;
}

const int maxn = 3000;
ModInt dp[maxn][maxn + 1][3];
int a[maxn];

const int R = 0; // marked R
const int L = 1; // marked L
const int notR = 2; // not marked L or R

int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) 
    cin >> a[i];
  vector<ModInt> v;
  v.push_back(3);
  for (int j = 0; j <= s; j++) {
    dp[0][j][R] = j == a[0] ? 1 : 0;
    dp[0][j][R] += j == 0 ? 1 : 0;
    dp[0][j][L] = j == 0 ? 1 : 0; 
    dp[0][j][notR] = j == a[0] ? 1 : 0;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      if (j >= a[i]) {
        dp[i][j][R] += dp[i - 1][j - a[i]][R];
        dp[i][j][notR] += dp[i - 1][j - a[i]][L]; 
        dp[i][j][notR] += dp[i - 1][j - a[i]][R];
        dp[i][j][R] += dp[i - 1][j - a[i]][L];
      }
      dp[i][j][R] += dp[i - 1][j][R];
      dp[i][j][R] += j == 0 ? 1 : 0;
      dp[i][j][L] += j == 0 ? 1 : 0;
      dp[i][j][notR] += dp[i - 1][j][R];
      dp[i][j][notR] += j == 0 ? 1 : 0;
      dp[i][j][notR] += dp[i - 1][j][notR];
    }
  }
  cout << dp[n - 1][s][notR] << '\n';
}

Measured memory_bytes: 105856
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 1e5 + 100;

ll X[2][N];
ll ans[10];

int main(){
	fio; cout<<fixed<<setprecision(25);	
	
	ll h , w , n;
	cin >> h >> w >> n;

	for(int i = 1; i <= n ; ++i){
		cin >> X[0][i] >> X[1][i];
	}
	map<pii , int> s;
	for(int i =1 ;i<= n ; ++i){
		for(int j = -2; j <= 0 ; ++j){
			for(int k = -2 ; k <= 0 ; ++k){
				int x = X[0][i]+j , y = X[1][i]+k;
				if(x >= 1 && y >= 1 && x+2 <= h && y+2 <= w)
					s[mp(x , y)]++; 
			}
		}

	}
	ll tot = (h-2)*(w-2);
	
	for(auto it : s){
		ans[it.S]++;
	}
	cout << tot-s.size() << endl;
	for(int i =1 ;i <= 9 ; ++i){
		cout << ans[i] << endl;
	}



	return 0;
}


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

#define REP(i,n) for (int i=0;i<(n);i++)
#define PII pair<int,int>
#define LL long long
#define vi vector<int>

int main() {
	int n;
	int a,b;
	int count = 0;
	cin >> n;
	a = n % 10;
	n /= 10;
	REP(i, 3) {
		b = n % 10;
		if (a == b) {
			count++;
			if (count == 2) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		else count = 0;
		a = b;
		n /= 10;
	}
	 cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
from itertools import accumulate, repeat, takewhile
from operator import mul


def main():
    N = int(next(sys.stdin.buffer))
    if N % 2:
        print(0)
        return
    print(sum(N // x for x in takewhile(lambda x: x <= N, accumulate(repeat(5), mul, initial=10))))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9264
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=100005;

int n,k,a[MAXN];

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	int st=1;
	while(st<=n&&a[1]==a[st])
		st++;
	printf("%d\n",(n-st+1+k-2)/(k-1));
	
	return 0;
}


Measured memory_bytes: 512
using System;

namespace AtCoder.Problems
{
    public class ProblemA
    {
        public static void Main(string[] args)
        {
            var s = new SolveA();
            s.Solve();
        }

        public class Scanner
        {
            private string[] _s;
            private int _i;
            private readonly char[] _separators = new char[] { ' ' };

            public Scanner()
            {
                _s = new string[0];
                _i = 0;
            }

            public string Next()
            {
                if (_i < _s.Length) return _s[_i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                _s = st.Split(_separators, StringSplitOptions.RemoveEmptyEntries);
                if (_s.Length == 0) return Next();
                _i = 0;
                return _s[_i++];
            }

            public int NextInt() => int.Parse(Next());
            public long NextLong() => long.Parse(Next());
            public ulong NextULong() => ulong.Parse(Next());
            public double NextDouble() => double.Parse(Next());

            public int[] GetIntArray(int n, int add = 0)
            {
                int[] array = new int[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextInt() + add;
                }
                return array;
            }

            public long[] GetLongArray(int n, long add = 0)
            {
                long[] array = new long[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextLong() + add;
                }
                return array;
            }

            public double[] GetDoubleArray(int n, double add = 0)
            {
                double[] array = new double[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextDouble() + add;
                }
                return array;
            }

            public string[] GetStringArray(int n)
            {
                string[] array = new string[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = Next();
                }
                return array;
            }
        }
    }

    public class SolveA
    {
        public void Solve()
        {
            var cin = new ProblemA.Scanner();
            var n = cin.NextLong();

            var result = GetAnswer(n);
            Console.WriteLine(result);
        }

        public string GetAnswer(long n)
        {
            var v = n % 10;
            switch (v)
            {
                case 2:
                case 4:
                case 5:
                case 7:
                case 9:
                    return "hon";

                case 0:
                case 1:
                case 6:
                case 8:
                    return "pon";

                case 3:
                    return "bon";
            }
            return null;
        }
    }
}


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

int N;
char s;
bool ans;

int main() { 
	cin >> N ;
	ans = false;

	for (int i = 0; i < N; i++) {
		cin >> s;
		if (s == 'Y') {
			ans = true;
		}
	}

	if (ans) {
		cout << "Four" << endl;
	}
	else {
		cout << "Three" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
tiles = input()
left = tiles[0]
count = -1
num = 0
for color in tiles:
    if left == color:
        count += 1
        if num == 0:
            left = color
        else:
            left = '0' if color == '1' else '1'
    else:
        left = color
    num += 1
print(count)


Measured memory_bytes: 3188
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  k <- unsafeTextToInt <$> T.getLine :: IO Int
  s <- T.getLine :: IO T.Text
  let
    (pf, sf) = T.splitAt k s :: (T.Text, T.Text)
  T.putStr pf
  T.putStrLn $ if T.null sf then T.empty else T.replicate 3 (T.singleton '.')

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 3740
#include <iostream>

using namespace std;

const int N = 2005;
int n, m, h[N][N], v[N][N], now, ans = 0;
bool mark[N][N];

int main()
{
	cin >> n >> m;
	char c;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			cin >> c;
			if (c == '#') mark[i][j] = 1;
		}
	}
	//for (int i = 1; i <= n; i++) {for (int j = 1; j <= m; j++) cout << mark[i][j]; cout << endl;}
	for (int i = 1; i <= n; i++)
	{
		now = 1;
		for (int j = 1; j <= m; j++)
		{
			if (j == m && !mark[i][j])
			{
				for (int k = now; k <= j; k++)
				{
					h[i][k] = j - now + 1;
				}
			}
			else if (mark[i][j])
			{
				if (now == j)
				{
					now++;
				}
				else
				{
					for (int k = now; k < j; k++)
					{
						h[i][k] = j - now;
					}
					now = j + 1;
				}
			}
		}
	}
	for (int j = 1; j <= m; j++)
	{
		now = 1;
		for (int i = 1; i <= n; i++)
		{
			if (i == n && !mark[i][j])
			{
				for (int k = now; k <= i; k++)
				{
					v[k][j] = i - now + 1;
				}
			}
			else if (mark[i][j])
			{
				if (now == i)
				{
					now++;
				}
				else
				{
					for (int k = now; k < i; k++)
					{
						v[k][j] = i - now;
					}
					now = i + 1;
				}
			}
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			//cout << h[i][j] << " ";
			if (!mark[i][j]) ans = max(ans, h[i][j] + v[i][j]);
		}
		//cout << endl;
	}
	cout << ans - 1 << endl;
	return 0;
}

Measured memory_bytes: 35584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <string>

using namespace std;

int main()
{
	stack<char> s;

	while (true){
		char str[128];
		fgets(str, sizeof(str), stdin);

		if (str[0] == '.'){
			break;
		}

		while (!s.empty()){
			s.pop();
		}

		bool flag = true;
		for (int i = 0; str[i] != '.'; i++){
			if (str[i] == '(' || str[i] == '['){
				s.push(str[i]);
			}

			if (str[i] == ')'){
				if (s.empty()){
					flag = false;
					break;
				}
				else if (s.top() == '('){
					s.pop();
				}
				else if (s.top() == '['){
					flag = false;
					break;
				}
			}
			if (str[i] == ']'){
				if (s.empty()){
					flag = false;
					break;
				}
				else if (s.top() == '['){
					s.pop();
				}
				else if (s.top() == '('){
					flag = false;
					break;
				}
			}
		}

		if (flag && s.empty()){
			puts("yes");
		}
		else {
			puts("no");
		}
	}

	return (0);
}

Measured memory_bytes: 1124
import Control.Arrow
import Control.Monad
import Data.Bits
import Data.Char
import Data.List

main :: IO ()
main = do
  n <- getInt
  xs <- getInts
  let ys = zipWith (-) xs [1..]
  let m = median ys
  print . sum . map (abs . subtract m) $ ys

getInt :: IO Int
getInt = readLn

getInts :: IO [Int]
getInts = map read . words <$> getLine

median :: Ord a => [a] -> a -- O(n log n)
median xs = sort xs !! (length xs `div` 2)


Measured memory_bytes: 164220
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i, c) for(long long i=0; i<(long long)c; i++)
const ll INF=1000000000000001;
int main() {
	int n;
	cin >>n;
	ll ans=0;
	vector<int>a(n);
	rep(i,n){
		cin >>a[i];
	}
	int mx;
	rep(i,n){
		if (i==0) mx =a[i];
		if (i>=1){
			if (a[i]>mx){
				mx=a[i];
			}
			if(a[i]<mx)ans+=(mx-a[i]);
		}
	}
	cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 4040
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    if(n == 1){
        Cout("Hello World");
        return 0;
    }
    Cin(int, a);
    Cin(int, b);
    Cout(a+b);
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

struct Node{
    int k,p;
    Node *l,*r;
};

Node *root;

Node *rightRotate(Node *t){
    Node *s=t->l;
    t->l=s->r;
    s->r=t;
    return s;
}

Node *leftRotate(Node *t){
    Node *s=t->r;
    t->r=s->l;
    s->l=t;
    return s;
}

Node *insert(Node *t,int k,int p){
    if(t==NULL){
        t=(Node *)malloc(sizeof(Node));
        t->k=k;
        t->p=p;
        t->l=t->r=NULL;
        return t;
    }
    if(k==t->k)return t;
    if(k<t->k){
        t->l=insert(t->l,k,p);
        if(t->p<t->l->p)t=rightRotate(t);
    }
    else{
        t->r=insert(t->r,k,p);
        if(t->p<t->r->p)t=leftRotate(t);
    }
    return t;
}

Node *find(Node *v,int k){
    while(v!=NULL&&k!=v->k){
        if(k<v->k)v=v->l;
        else v=v->r;
    }
    return v;
}

Node *del(Node *t,int k){
    if(t==NULL)return NULL;
    if(k<t->k)t->l=del(t->l,k);
    else if(k>t->k)t->r=del(t->r,k);
    else{
        if(t->l==NULL&&t->r==NULL)return NULL;
        else if(t->l==NULL)t=leftRotate(t);
        else if(t->r==NULL)t=rightRotate(t);
        else{
            if(t->l->p>t->r->p)t=rightRotate(t);
            else t=leftRotate(t);
        }
        return del(t,k);
    }
    return t;
}

void inorder(Node* v){
    if(v==NULL)return;
    inorder(v->l);
    cout<<" "<<v->k;
    inorder(v->r);
}

void preorder(Node* v){
    if(v==NULL)return;
    cout<<" "<<v->k;
    preorder(v->l);
    preorder(v->r);
}

void run(){
    int n;
    cin>>n;
    rep(i,n){
       string s;
       cin>>s;
       if(s=="insert"){
           int k,p;
           cin>>k>>p;
           root=insert(root,k,p);
       }
       else if(s=="find"){
           int k;
           cin>>k;
           cout<<(find(root,k)!=NULL?"yes":"no")<<endl;
       }
       else if(s=="print"){
           inorder(root);
           cout<<endl;
           preorder(root);
           cout<<endl;
       }
       else{
           int k;
           cin>>k;
           root=del(root, k);
       }
   }
}



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

using namespace std;

const long long MAX_BIT = 60;

long long a, b, ans;

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

    cin >> a >> b;

    long long mostBit = 0ll;
    for (long long bit = MAX_BIT; bit >= 0ll; bit--) {
        if ((a & (1ll << bit)) + (b & (1ll << bit)) != (1ll << bit)) {
            a = a & ~(1ll << bit);
            b = b & ~(1ll << bit);
        } else {
            mostBit = 1ll << bit;

            break;
        }
    }

    b = b & ~mostBit;

    long long mostBit2 = 0ll;
    for (long long bit = MAX_BIT; bit >= 0ll; bit--) {
        if ((b & (1ll << bit)) > 0) {
            mostBit2 = 1ll << bit;

            break;
        }
    }

//    for (int bit = 0; bit <= MAX_BIT; bit++) {
//        if ((a & (1ll << bit)) > 0) {
//            cerr << 1;
//        } else {
//            cerr << 0;
//        }
//    }
//
//    cerr << '\n';
//
//    for (int bit = 0; bit <= MAX_BIT; bit++) {
//        if ((b & (1ll << bit)) > 0) {
//            cerr << 1;
//        } else {
//            cerr << 0;
//        }
//    }
//
//    cerr << '\n';
//
//    cerr << mostBit << ' ' << mostBit2 << '\n';

    ans = (mostBit - a) + max(1ll, min(mostBit, (mostBit - a) + max(1ll, 2 * mostBit2)));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int h, w, counth, countw;
    while(1){
        scanf("%d %d", &h, &w);
        if(h == 0 && w == 0) break;
        for(counth = 0; counth < h; counth ++){
            for(countw = 0; countw < w; countw ++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

int main() {

	int a, b, c;
	ll n;
	cin >> a >> b >> c>>n;

	int ta, tb, tc;

		ta = a;
		tb = b;
		tc = c;

		a = (tb + tc);
		b = (tc + ta);
		c = (ta + tb);

	int ansE = ta - tb;
	int ansO = a - b;

	if (n % 2 == 0) {
		cout << ansE << endl;
	}
	else {
		cout << ansO << endl;
	}
	
	
}


Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll W, a, b;
    cin >> W >> a >> b;
    if (a+W < b) {
        print(b-a-W);
    } else if (b+W < a) {
        print(a-b-W);
    } else {
        print(0);
    }
    return 0;
}


Measured memory_bytes: 256
import math
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
"""
int(input())
map(int,input().split())
list(map(int,input().split()))
"""


            
       

t=1
for term in range(1,t+1):
    r=int(input())
    print(2*math.pi*r)

Measured memory_bytes: 9580
#include <stdio.h>
#include <math.h>

int main(){
	double x1,y1,x2,y2;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	printf("%lf",sqrt(pow(x1-x2,2)+pow(y1-y2,2)));
	return 0;
}	

Measured memory_bytes: 652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;

int main() {
	ll n;
	int ans = 20;
	cin >> n;
	for (ll i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			int temp;
			temp = max(to_string(i).size(), to_string(n / i).size());
			ans = min(ans, temp);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

int h[100005][3];
int dp[100005][3];

int main()
{
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
        cin >> h[i][0] >> h[i][1] >> h[i][2];
    
    for(int i=1;i<=n;i++)
    {
        dp[i][0] = max(dp[i-1][1] + h[i][0], dp[i-1][2]+ h[i][0]);
        dp[i][1] = max(dp[i-1][0] + h[i][1], dp[i-1][2]+ h[i][1]);
        dp[i][2] = max(dp[i-1][1] + h[i][2], dp[i-1][0]+ h[i][2]);
    }


    cout << max(max(dp[n][0], dp[n][1]), dp[n][2]) << endl;




}

Measured memory_bytes: 2560
//ITP1_10_B_19140837_Ojima_Yukiya.cpp
//提出日 2020/6/24 wednesday
//プログラミング基礎演習2 CS 第７回課題 ITP1_10_B
//学修番号 19140837　小島優希也
#include <iostream>
#include <math.h>
using namespace std;

int main(void) {
    double a, b, c, r;
    cin >> a >> b >> c;
    r = M_PI / 180.0 * c;
    printf("%8lf\n", a * b / 2 * sin(r));
    printf("%8lf\n", a + b + sqrt(b*b + a*a - 2*a*b*cos(r)));
    printf("%8lf\n", b*sin(r));
    return 0;
}


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

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

*x, = map(int, readline().split())

for i, x_ in enumerate(x, 1):
    if x_ == 0:
        print(i)


Measured memory_bytes: 27076
// Library
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

// CONSTANTS
#define SZA 0
#define SZB 0

// MACRO
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "YES" : "NO")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

#define F1 first
#define S2 second
#define PB push_back
#define MP make_pair


// Global Tables

//ull gPreProcess[SZA][SZB];

// Functions

void Print2DVector(vector<vector<int>>& v)
{
    ull i, j; 
    for(i = 0; i < v.size(); i++)
    {
        for(j = 0; j < v[i].size(); j++)
        {
            cout << v[i][j];
            if(j == v[i].size()-1)
            {
                cout << endl;
            }
            else
            {
                cout << " ";
            }
        }
    }
}

void PrintVector(vi& v)
{
    ull i;
    for(i = 0; i < v.size(); i++)
    {
        cout << v[i];
        if(i == v.size()-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PrintArr(int* a, ull N)
{
    ull i;
    for(i = 0; i < N; i++)
    {
        cout << a[i];
        if(i == N-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PreProcessTables()
{
    ull i, j;
    for(i = 0; i < SZA; i++)
    {
        for(j = 0; j < SZB; j++)
        {
            break;
        }
        break;
    }
}

void TC(int t)
{
    ull S;
    cin >> S;
    ull mod_val = 1E9+7;
    ull dp[S+1];
    for(int i = 0; i < S+1; i++)
    {
        if(i > 2)
        {
            dp[i] = 1;
        }
        else
        {   
            dp[i] = 0;
        }
    }
    for(int i = 6; i < S+1; i++)
    {
        for(int j = 3; j < i-2; j++)
        {
            dp[i] = (dp[i] + dp[i-j])%mod_val;
        }
    }
    cout << dp[S] << endl;
}

// Main

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

    int T =1 , t;
    //cin >> T;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


Measured memory_bytes: 3668
#include <cstdio>
using namespace std;
typedef long long LL;
const int maxn=100001;
const LL mod=1e9+7;

int n,x[maxn];
LL ans;
int cnt;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	
	cnt=0;ans=1;
	for(int i=1;i<=n;i++)
	{
		cnt++;
		if (x[i]<2*cnt-1)
	    {
	    	ans=(ans*cnt)%mod;
	    	cnt--;
	    }
    }
	    
	for(int i=2;i<=cnt;i++)
	    ans=(ans*i)%mod;
	printf("%I64d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;

int main(){
    int M,D;
    cin>>M>>D;
    int count=0;
    FOR(i,10,D+1){
        int d1=i%10;
        int d2=i/10;
        
        FOR(j,1,M+1){
        if(d1>=2&&d2>=2&&d1*d2==j){
                count++;
            }
        }
    }
    
    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int D;
	scanf("%d",&D);
	if(D==25){
		printf("Christmas");
	}
	if(D==24){
		printf("Christmas Eve");
	}
	if(D==23){
		printf("Christmas Eve Eve");
	}
	if(D==22){
		printf("Christmas Eve Eve Eve");
	}
	return 0;
}


Measured memory_bytes: 128
//gacha

#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    int N;
    cin >> N;
    //vector<string> S;
    map<string,bool> S;
    for (int i = 0; i < N; i++) {
        string tmp;
        cin >> tmp;
        S[tmp] = true;
        //S.push_back(tmp);
    }
    cout << S.size();
    return 0;
}

Measured memory_bytes: 18732
S=set(input())
arr=set(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'])
result=arr-S
if len(result)==0:
  print('None')
else:
  print(sorted(result)[0])


Measured memory_bytes: 3188
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

int main()
{
    ll K, X;
    cin >> K >> X;



    for (ll i = X - K + 1; i < X + K - 1; ++i) {
        cout << i << " ";
    }
    cout << X + K - 1;

}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let s: u32 = sc.read();
    let h = s / 60 / 60;
    let m = s / 60 % 60;
    let s = s % 60;
    println!("{}:{}:{}", h, m, s);
}



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

#define int long long

signed main() {
    int X;
    cin >> X;
    int f = 0;
    for (int i = 1; i <= 100000000; i *= 10) {
        f += X % (i * 10) / i;
    }
    if (X % f == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define  st first
#define  nd second
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define maxn  100001
#define M   1000000007
#define int long long
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef cc_hash_table<int, int, hash<int > > ht;



int32_t main(){

  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int n ;
  cin >> n;
  cout << ( n/2 + n%2) / (n*1.0);



}


Measured memory_bytes: 256
#include <iostream>
int main(){
	int a, n;
	int counter = 0;
	std::cin>> n;
	for (int i = 0; i < n; i++){
		std::cin >> a;
		while(1){
			if (a%2==0){
				counter++;
				a = a / 2;
			}else{
				break;
			}
		}
	}
	std::cout << counter << std::endl;
	return 0;
}


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

using namespace std;

#define int long long
const int N = 3e5+1 ,mod = 998244353;

int n,a,b,k,ans;
int Pow[N];
int cal( int a,int b){
	if(b == 1) return a;
	int res = cal(a,b/2);
	res = (res*res) % mod;
	if( b % 2 ) res = (res * a) % mod;
	return res;	
}
int Ckn(int k,int n){
	if(k > n) return 0LL;
	int res = Pow[n];
	res = (res * cal( (Pow[k]*Pow[n-k])%mod, mod-2)) % mod;
	return res;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> a >> b >> k;
	Pow[0] = 1;
	for(int i = 1 ; i <= n ; ++ i)
		Pow[i] = (Pow[i-1] * i) % mod;
	for(int i = 0 ; i <= n ; ++ i){
		int x = i;
		int y = k - a * i;
		if(y < 0 | y % b) continue;
		y /= b;
		ans = (ans + (Ckn(x,n)*Ckn(y,n)) % mod) % mod;
	}
	cout << ans;
}

Measured memory_bytes: 2560
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 
const ll inf = (ll)(1e9+7);



int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n, m, l; cin >> n >> m >> l;
  ll adj[n+1][n+1], bdj[n+1][n+1]; 
  memset(adj, inf, sizeof adj);
  memset(bdj, inf, sizeof bdj);
  for(ll i = 1; i <= n; i++) {
    adj[i][i] = 0;
    bdj[i][i] = 0;
  }
  for(ll i = 0; i < m; i++) {
    ll x, y, z;
    cin >> x >> y >> z;
    if(z > l) continue;
    adj[x][y] = z;
    adj[y][x] = z;
  }
  for(ll k = 1; k <= n; k++) {
    for(ll i = 1; i <= n; i++) {
      for(ll j = 1; j <= n; j++) {
        if(adj[i][j] > adj[i][k] + adj[k][j]) adj[i][j] = adj[i][k] + adj[k][j];
      }
    }
  }
  for(ll i = 1; i <= n; i++) {
    for(ll j = i+1; j <= n; j++) {
      if(adj[i][j] <= l) {
        bdj[i][j] = 1;
        bdj[j][i] = 1;
      }
    }
  }
  for(ll k = 1; k <= n; k++) {
    for(ll i = 1; i <= n; i++) {
      for(ll j = 1; j <= n; j++) {
        if(bdj[i][j] > bdj[i][k] + bdj[k][j]) bdj[i][j] = bdj[i][k] + bdj[k][j];
      }
    }
  }
  ll q; cin >> q;
  while(q--) {
    ll a, b;
    cin >> a >> b;
    ll ans = bdj[a][b];
    if(ans >= inf) cout << -1;
    else cout << ans - 1;
    cout << endl;
  }
  return 0;
} //good night.

Measured memory_bytes: 1920
S = input()
S = S+"A"
SL = [i for i in S]
top = SL[0]
ans = 0
for i in range(1,len(SL)):
    if top == SL[i]:
        ans += 1
        if SL[i] == "0":
            SL[i] = "1"
        else:
            SL[i] = "0"
        top = SL[i]
    else:
        top = SL[i]

print(ans)

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

int N;
int arr[200001];

int main() {
    cin>>N;
    for(int i=0;i<N;i++) {
        cin>>arr[i];
        arr[i]-=i+1;
    }

    sort(arr,arr+N);

    int b = arr[N/2];
    long long ret = 0;
    for(int i=0;i<N;i++) ret+=abs(b-arr[i]);
    cout<<ret;
}

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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int road = sc.nextInt();
		int[] floor = new int[road];
		int[] second = new int[road];
		for(int i = 0; i<road; i++) {
			floor[i] = sc.nextInt();
			second[i] = floor[i];
		}
		Arrays.sort(floor);
		//max値を取り出す。
		for(int i = 0; i<floor.length; i++) {
			if(second[i] == floor[road-1]) {
					System.out.println(floor[road-2]);
			}else {
				System.out.println(floor[road-1]);
			}
		}
	}
}

Measured memory_bytes: 94316
#include "bits/stdc++.h"
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define int long long int
#define tc int t; cin>>t; while(t--)
#define fora(i,n) for(int i=0;i<n;i++)
#define forb(i,a,n) for(int i=a;i<n;i++)
#define dbg(x)    { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)  { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define mod 1000000007
#define pb push_back
#define pii pair<int,int>
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1);}
void solve() {
    int n; cin>>n;
    int arr[n];
    fora(i,n) cin>>arr[i];
    int cnt=0;
    fora(i,n) {
        for(int j=i+1;j<n;j++) {
            for(int k=j+1;k<n;k++) {
                if(arr[i]!=arr[j]&&arr[j]!=arr[k]&&arr[i]!=arr[k]) {
                    if(arr[i]+arr[j]>arr[k]&&arr[i]+arr[k]>arr[j]&&arr[k]+arr[j]>arr[i]) {cnt++;
                        // cout<<arr[i]<<" "<<arr[j]<<" "<<arr[k]<<"\n"; } 
                    }
                }
            }
        }
    }
    cout<<cnt<<"\n";
}
int32_t main()
{
    fastio
    solve();  
    

    return 0;


}

Measured memory_bytes: 3652
import java.util.*;
import java.io.*;

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int A1 = in.nextInt();
        int A2 = in.nextInt();
        int A3 = in.nextInt();
        if(A1+A2+A3 >= 22)
        {
            System.out.println("bust");
        }
        else
            {
                System.out.println("win");
            }







        }







    }
















Measured memory_bytes: 35692