akhauriyash/Code-Regression huggingface dataset:
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
struct Combination{
private:
    ll N;
    vector<ll> fac, facinv;

public:
    Combination(ll n){
        N = n;
        fac.push_back(1); fac.push_back(1);
        rep(i,2,N+1) fac.push_back(fac[i-1] * i % MOD);
        rep(i,0,N+1) facinv.push_back(power(fac[i], MOD-2));
    }
    ll power(ll x, ll n){
        if(n == 0) return 1LL;
        ll res = power(x * x % MOD, n/2);
        if(n % 2 == 1) res = res * x % MOD;
        return res;
    }
    ll nck(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[k] % MOD * facinv[n-k] % MOD;
    }
    ll npk(ll n, ll k){
        if(k == 0 || n == k) return 1LL;
        return fac[n] * facinv[n-k] % MOD;
    }
    ll get(ll x){return fac[x];};
    ll getinv(ll x){return facinv[x];};
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll B,W;
    cin >> B >> W;
    Combination cb(200010);

    ll p[200010] = {}, q[200010] = {};
    p[B] = cb.power(cb.power(2, B), MOD-2);
    rep(i,B+1,B+W){
        p[i] = p[i-1] + cb.power(2, MOD-2) * cb.nck(i-1, B-1) % MOD * cb.power(cb.power(2, i-1), MOD-2) % MOD;
        p[i] %= MOD;
    }
    q[W] = cb.power(cb.power(2, W), MOD-2);
    rep(i,W+1,B+W){
        q[i] = q[i-1] + cb.power(2, MOD-2) * cb.nck(i-1, W-1) % MOD * cb.power(cb.power(2, i-1), MOD-2) % MOD;
        q[i] %= MOD;
    }
    rep(i,0,B+W){
        ll ans = (1 - p[i] + q[i] + MOD) * cb.power(2, MOD-2) % MOD;
        print(ans);
    }


}


Measured memory_bytes: 8560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100010;
struct edge {
	int u, v;
	ll w;
	edge(int u, int v, ll w) : u (u), v (v), w (w) {}
};
struct data {
	ll x, y;
	int id;
} a[N];
int n;
int fa[N];
ll ans;
vector<edge> e;
bool cp(edge x, edge y)
{
	return x.w < y.w;
}
bool cp1(data x, data y)
{
	return x.x < y.x;
}
bool cp2(data x, data y)
{
	return x.y < y.y;
}
int find(int x)
{
	return x == fa[x] ? x : fa[x] = find(fa[x]);
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) fa[i] = i;
	for(int i = 1; i <= n; ++i)
	{
		scanf("%lld%lld", &a[i].x, &a[i].y);
		a[i].id = i;
	}
	sort(a + 1, a + n + 1, cp1);
	for(int i = 2; i <= n; ++i)
		e.push_back(edge(a[i].id, a[i - 1].id, a[i].x - a[i - 1].x));
	sort(a + 1, a + n + 1, cp2);
	for(int i = 2; i <= n; ++i)
		e.push_back(edge(a[i].id, a[i - 1].id, a[i].y - a[i - 1].y));
	sort(e.begin(), e.end(), cp);
	for(int i = 0; i < e.size(); ++i)
	{
		if(find(e[i].u) == find(e[i].v)) 
			continue;
		ans += e[i].w;
		fa[find(e[i].u)] = find(e[i].v);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 9200
def calc
  rectangle = 0
  rhombus = 0
  while gets
    x, y, z = $_.split(',').map(&:to_i)
    if x ** 2 + y ** 2 == z ** 2
      rectangle += 1
    elsif x == y
      rhombus += 1
    end
  end
  puts rectangle
  puts rhombus
end

calc

Measured memory_bytes: 8504
#include <iostream>
using namespace std;
int main()
{
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  bool t = true;
  while(true)
  {
     if (t){
        if (C - B <= 0){
          cout << "Yes"; break;}
        C = C - B;
     }
     if (!t)
     {
       if (A - D <= 0)
       { cout << "No"; break;}
       A = A - D;
     }
     t = !t;
  }
}

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

int a[200005];
int d[200005];

int main()
{
    int n;
    scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%d",&a[i]);
    if (n==0)  //0个元素特判一下
    {
        printf("0\n");
        return 0;
    }
    d[1]=a[1];  //初始化
    int len=1;
    for (int i=2;i<=n;i++)
    {
        if (a[i]<=d[len]) d[++len]=a[i];  //如果可以接在len后面就接上
        else  //否则就找一个最该替换的替换掉
        {
            int j=lower_bound(d+1,d+len+1,a[i])-d;  //找到第一个大于它的d的下标
            d[j]=a[i];
        }
    }
    printf("%d\n",len);
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>                                                                                       
using namespace std;                                                                                     
int main(){                                                                                              
  int a, b, c, ret;                                                                                      
  cin >> a>>b>>c;                                                                                        
  ret = 0;                                                                                               
  for(int i=a; i<b+1; i++){                                                                              
    if (c%i==0){                                                                                         
      ret++;                                                                                             
    }                                                                                                    
  }                                                                                                      
  cout << ret << endl;                                                                                   
} 


Measured memory_bytes: 3096
import sys 
from functools import lru_cache
sys.setrecursionlimit(10**6)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = int(readline())
K = int(readline())
@lru_cache(None)
def f(N,K):
    if K == -1:
        return 0
    if N < 10:
        if K == 0:
            return 1
        elif K == 1:
            return N
        else:
            return 0
    ans = 0
    q, mod = divmod(N, 10)
    ans += f(q,K) + mod * f(q,K-1) + (9-mod) * f(q-1,K-1) 
    return ans
print(f(N,K))

Measured memory_bytes: 9676
import re
# import doctest


class IO_for_Contest(object):
    @staticmethod
    def my_input():
        # return raw_input()
        return input()

    @staticmethod
    def read_from_input():
        pass

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map(
                    int,
                    re.split('\s+', IO_for_Contest.my_input().strip())))[: n]


def solve():
    buf = IO_for_Contest.read_n_int(3)
    a = buf[0]
    b = buf[1]
    c = buf[2]
    print(min_diff(a, b, c,))


def min_diff(a, b, c):
    if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
        return 0
    diff = a * b * c
    diff = min(diff, abs(a * b * (c // 2) - a * b * (c - (c // 2))))
    diff = min(diff, abs(a * (b // 2) * c - a * (b - (b // 2)) * c))
    diff = min(diff, abs((a // 2) * b * c - (a - (a // 2)) * b * c))
    return diff

if __name__ == '__main__':
    # doctest.testmod()
    solve()

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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a == 1) a+= 13;
  if (b == 1) b+= 13;
  if ( a == b) {
    cout << "Draw" << endl;
  } else if (a > b) {
    cout << "Alice" << endl;
  } else cout << "Bob" << endl;
  
  return 0;
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    string s;cin>>s;
    int cnt=0;
    rep(i,s.size()){
        if(s[i]=='o'){
            cnt++;
        }
    }

    if(15-s.size()+cnt>=8){
        cout<<"YES"<<endl;
        return 0;
    }
    cout<<"NO"<<endl;
}


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

int main() {
  int N; // <= 8
  int M; // <= 8 * (8 - 1) / 2 = 28
  cin >> N >> M;

  vector<vector<bool>> G(N, vector<bool>(N, false));
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--; // 0-indexed
    // 無向グラフ
    G.at(a).at(b) = true;
    G.at(b).at(a) = true;
  }

  // 順列用の配列データを作成する
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    v.at(i) = i;
  }

  // ソート済みのため、next_permutation で全パターンを検索する
  int ans = 0;
  do {
    // 0 から開始ではない組合せはスキップ
    if (v.at(0) != 0) {
      continue;
    }

    // 0 から開始のパターンについて、パスが全て存在するかチェック
    // 存在しなければ false とする
    bool enabling = true;
    for (int i = 0; i < (N - 1); i++) {
      int from = v.at(i);
      int to = v.at(i + 1);
      if (G.at(from).at(to) == false) {
        enabling = false;
      }
    }

    if (enabling) {
      ans++;
    }
  } while (next_permutation(v.begin(), v.end()));

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

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

class Program
{

    public static void Main( )
    {
        var input = Console.ReadLine( ).Split( ).ToArray( );
        var N = int.Parse( input[ 0 ] );
        var K = long.Parse( input[ 1 ] );
        var next = Console.ReadLine( ).Split( ).Select( int.Parse ).Prepend( 0 ).ToArray( );  // int[N+1]
        var dist = Enumerable.Repeat( -1, N + 1 ).ToArray( );
        var queue = new Queue<int>( N );
        int cycleStart, cycleLength;


        queue.Enqueue( 1 );
        dist[ 0 ] = dist[ 1 ] = 0;
        while ( true )
        {
            var id = queue.Dequeue( );
            var nextId = next[ id ];
            bool isReached = ( dist[ nextId ] != -1 );
            if ( isReached )
            {
                cycleStart = nextId;
                cycleLength = dist[ id ] + 1 - dist[ nextId ];
                break;
            }
            else
            {
                queue.Enqueue( nextId );
                dist[ nextId ] = dist[ id ] + 1;
            }
        }


        int untilCycle = dist[ cycleStart ];
        int v;
        if ( K <= untilCycle )
        {
            v = 1;
            for ( int i = 0; i < K; i++ ) v = next[ v ];
        }
        else
        {
            v = cycleStart;
            long f = ( K - untilCycle ) % cycleLength;
            for ( int i = 0; i < f; i++ ) v = next[ v ];
        }
        Console.WriteLine( v );
    }

}

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

int main(){
  int a,b,cnt=0;
  cin>>a>>b;
  for(int i=a; i<=b; i++){
    int t1= i/1000;
    int t2= i%100;
    int temp = (t2%10)*10 + t2/10;
    if(t1==temp)cnt++;
  }
  cout<<cnt<<endl;
}


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

using namespace std;

using ll = long long;

const int MOD = 1e9 + 7;

char a[1005][1005];
int mem[1005][1005], n, m;

ll dp(int i, int j)
{
    if(i == n - 1 && j == m - 1)
        return 1;

    if(i == n || j == m)
        return 0;

    if(a[i][j] == '#')
        return 0;

    if(mem[i][j] != -1)
        return mem[i][j];

    ll path1 = dp(i + 1, j) % MOD;
    ll path2 = dp(i, j + 1) % MOD;

    return mem[i][j] = (path1 + path2) % MOD;
}

int main()
{
    memset(mem, -1, sizeof(mem));

    scanf("%d%d", &n, &m);

    for(int i = 0; i < n; i++)
            scanf("%s", &a[i]);

    printf("%d", dp(0, 0));
}

Measured memory_bytes: 5248
I=lambda:[int(i)for i in input().split()]
n,m=I()
P=I()
D={i:i for i in range(n)}
def U(x):
  if D[x]!=x:
    D[x]=U(D[x])
  return D[x]
for _ in [0]*m:
  x,y=I();D[U(x-1)]=U(y-1)
print(sum(U(i)==U(p-1)for i,p in enumerate(P)))




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

int main() {
    int n,d,c=0;
    cin>>n>>d;
    vector<int> v;
    int a=(d+1);
    while(a<=n){
        c++;
        v.push_back(a);
        a+=(2*d+1);
    }
    if(c==0){
        cout<<"1";
        return 0;
    }
    
    if((n-(*(v.end()-1)))>d)
    c++;
    cout<<c;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
ll dp[100010][3];
char op[100010];
ll A[100010];

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

	int N;
	cin >> N;
	op[0] = '+';
	for(int i = 0; i < N; i++) {
		cin >> A[i];
		if(i != N - 1) cin >> op[i + 1];
	}

	fill((ll*)begin(dp), (ll*)end(dp), -INF);
	dp[0][0] = 0;
	for(int i = 0; i < N; i++) {
		for(int j = 0; j <= 2; j++) {
			if(dp[i][j] == -INF) continue;
			ll d = dp[i][j];
			if(op[i] == '+') {
				for(int k = 0; k <= j; k++) {
					if(j % 2 == 0) {
						dp[i + 1][k] = max(dp[i + 1][k], d + A[i]);
					}
					else {
						dp[i + 1][k] = max(dp[i + 1][k], d - A[i]);
					}
				}
			}
			else {
				int nj = min(2, j + 1);
				for(int k = 0; k <= min(2, j + 1); k++) {
					if((j + 1) % 2 == 0) {
						dp[i + 1][k] = max(dp[i + 1][k], d + A[i]);
					}
					else {
						dp[i + 1][k] = max(dp[i + 1][k], d - A[i]);
					}
				}
			}
		}
	}

	cout << dp[N][0] << endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int r;
    cin >> r;
    cout << r * r << '\n';
}

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


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

int NextNum( int num )
{
	if ( num % 2 == 0 ) {
		return num / 2;
	}
	else {
		return 3 * num + 1;
	}
}

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

	int next = s;
	vector<int> seq;
	seq.push_back( next );

	while ( true ) {
		next = NextNum( next );
		for ( vector<int>::iterator iter = seq.begin();
				iter != seq.end(); ++iter ) {
			if ( *iter == next ) {
				cout << seq.size() + 1 << endl;
				return 0;
			}
		}
		seq.push_back( next );
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
    int H = Integer.parseInt(sc.next());
    int W = Integer.parseInt(sc.next());
char[][] a=new char[H][W];
    for (int i = 0; i < H; i++) {
        String p=sc.next();
        for (int j = 0; j < W; j++) {
            a[i][j]=p.charAt(j);
        }
    }
    for (int i = 0; i < W+2; i++) {
        out.print("#");
    }out.println();
    for (int i = 0; i <H; i++) {
        for (int j = 0; j <=W; j++) {
            if(j==0)out.print("#");
            if(j!=W)out.print(a[i][j]);
            if(j==W)out.print("#");
        }
        out.println();
    }
    for (int i = 0; i < W+2; i++) {
        out.print("#");
    }out.println();
}
}

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


int main(){
    int n, k;
    cin >> n >> k;
    double ans = 0.0;
    for(int i = 1; i <= n; i++){
        int x = i;
        double p = 1.0;
        while(x < k){
            p *= 0.5;
            x *= 2;
        }
        ans += p / n;
    }
    printf("%.12f\n", ans);
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast","unroll-loops")
#pragma GCC target("avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); ++i)
#define iter(it,c) for (__typeof((c).begin()) \
  it = (c).begin(); it != (c).end(); ++it)
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
const ll INF = ~(1<<31);

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
  return (a % b + b) % b; }

string S, T, A = "";
int memo[3050][3050];

int dp(int s, int t){ 
    if (s == -1 || t == -1) return 0;
    if (memo[s][t] != -1) return memo[s][t];
    if (S[s] == T[t]) return memo[s][t] = 1 + dp(s-1, t-1);
    else return memo[s][t] = max(dp(s - 1, t), dp(s, t - 1));
}

void bt(int s, int t, int ans){
    if (ans == 0) return;
    if (s == -1 || t == -1) return;

    if (S[s] == T[t]){
        bt(s - 1, t - 1, ans - 1);
        A += S[s];
        return;
    }
    if (dp(s-1, t) == ans){
        bt(s-1, t, ans);
        return;
    }
    else {
        bt(s, t-1, ans);
        return;
    }
}

int main(){
    cin >> S >> T;
    memset(memo, -1, sizeof(memo));
    bt(S.size() - 1, T.size() - 1, dp(S.size() - 1, T.size() - 1));
    cout << A;
    return 0;
}

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

using namespace std;
typedef long long ll;

char S[100005];
int N;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> S;
    N = strlen(S);

    int g = 0;
    int s = 0;
 
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'g') {
            if (g > 0) {
                g--;
                s++;
            } else {
                g++;
            }
        } else {
            // 'p'
            if (g > 0) {
                g--;
            } else {
                s--;
                g++;
            }
        }
    }

    cout << s << endl;

    return 0;
}



Measured memory_bytes: 384
n,m=map(int,input().split())
xyz,xy_z,x_yz,_xyz,x_y_z,_xy_z,_x_yz,_x_y_z=[],[],[],[],[],[],[],[]
ans=[]
for i in range(n):
  x,y,z=map(int,input().split())
  xyz.append(x+y+z)
  xy_z.append(x+y-z)
  x_yz.append(x-y+z)
  _xyz.append(-x+y+z)
  x_y_z.append(x-y-z)
  _xy_z.append(-x+y-z)
  _x_yz.append(-x-y+z)
  _x_y_z.append(-x-y-z)
xyz.sort(reverse=True);ans.append(sum(xyz[0:m]))
xy_z.sort(reverse=True);ans.append(sum(xy_z[0:m]))
x_yz.sort(reverse=True);ans.append(sum(x_yz[0:m]))
_xyz.sort(reverse=True);ans.append(sum(_xyz[0:m]))
x_y_z.sort(reverse=True);ans.append(sum(x_y_z[0:m]))
_xy_z.sort(reverse=True);ans.append(sum(_xy_z[0:m]))
_x_yz.sort(reverse=True);ans.append(sum(_x_yz[0:m]))
_x_y_z.sort(reverse=True);ans.append(sum(_x_y_z[0:m]))
print(max(ans))


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

// a と b の最大公約数を返す関数
int64_t GCD(int64_t a, int64_t b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    int64_t N;
    cin >> N;
    vector<int64_t> A(N);
    for ( int64_t i = 0; i < N; ++i){
        cin >> A[i];
    }
    
    int64_t ans = A[0];
    for ( int64_t i = 1; i < N; ++i){
        ans = GCD(ans,A[i]);
    }
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 4024
import math

A,B = map(int, input().split())

ans = '-1'

for i in range(1001):
    if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
        ans = str(i)
        break

if ans == '-1':
    print(ans)
else:
    print(int(ans))

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
int read()
{
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
const int inf=0x3f3f3f3f;

ll n,a[100010],b[100010],c[100010];

int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
    sort(a+1,a+n+1);
	int tot=0;
    for(int i=1;i<=n;i++)if(a[i]==b[tot])c[tot]++;else{
    	b[++tot]=a[i];c[tot]=1;}
    long long ans=0;
    for(int i=1;i<=tot;i++)if(c[i]>=4)ans=max(ans,b[i]*b[i]);
    int cnt=0;
    for(int i=tot;i>=1;i--)if(c[i]>=2){
    	if(cnt){
    		ans=max(ans,b[cnt]*b[i]);
    		break;
    	}
    	else{
    		cnt=i;
    	}
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 2560
//ITP1_4_D

using System;
using System.Collections.Generic;


 class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int max = -1000000, min = 1000000;
        double sum = 0;

        //?????????????????????????????????int??????iaaray????????????????????\

        int[] iarray = Array.ConvertAll<string, int>((Console.ReadLine().Split(' ')), delegate (string value)
        {
            return int.Parse(value);
        });

        for(int i = 0;i < n; i++)
        {
            sum += iarray[i];                   //????¨?????????????

            if (iarray[i] > max)                //?????§???????????§???????????°??´??°
                max = iarray[i];
            if (iarray[i] < min)                //????°???????????°????????????°??´??°
                min = iarray[i];
        }

        Console.WriteLine(min + " " + max + " " + sum);         //????°????????????§??????????¨??????????
    }
}

Measured memory_bytes: 9860
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  string a,b,c;
  cin>>a;
  cin>>b;
  cin>>c;
  char x=a[0];
  a.erase(0,1);
  char y='A';
  while(1){
    if(x=='a'){
      if(a.size()==0){
        break;
      }
      x=a[0];
      a.erase(0,1);
    } else if(x=='b'){
      if(b.size()==0){
        y='B';
        break;
      }
      x=b[0];
      b.erase(0,1);
    } else if(x=='c'){
      if(c.size()==0){
        y='C';
        break;
      }
      x=c[0];
      c.erase(0,1);
    }
  }
  cout<<y<<endl;
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

N, A = map(int, input().split())
x = list(map(int, input().split()))

y = []
for xi in x:
    yi = xi - A
    y.append(yi)
X = max(x + [A])
NX = N * X

dp = defaultdict(int)
dp[(0, 0)] = 1
for i in range(N):
    for t in range(-NX, NX + 1):
        dp[(i + 1, t)] = dp[(i, t)] + dp[(i, t - y[i])]
print(dp[(N, 0)] - 1)


Measured memory_bytes: 71536
# -*- codinf: utf-8 -*-
import math
A, B, H, M = map(int, input().split())

angle_H = (H + (M/60)) * 360 / 12
angle_M = M * 360 / 60
angle = angle_H - angle_M
a = A * math.sin(math.radians(angle))
b = B - A * math.cos(math.radians(angle))
distance = math.sqrt( a** 2 + b ** 2 )
print(distance)

Measured memory_bytes: 62496
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 11100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a;scanf("%d",&a);
	printf("%d\n",a+a*a+a*a*a);
}

Measured memory_bytes: 1732
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dif = []
c = Counter(a)
a = list(set(a))
for i in range(len(a)):
        if c[a[i]] - a[i] > 0:
                dif.append(c[a[i]] - a[i])
        elif c[a[i]] - a[i] < 0:
                dif.append(c[a[i]])
print(sum(dif))

Measured memory_bytes: 20592
#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 <math.h>
using namespace std;
#define int long long


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    string s; cin >> s;
    int n = s.size()+1;
    vector<int> a(n);

    vector<int> countl(n),countr(n);

    for(int i = 0;i < n-1;i ++){
        if(s.at(i) == '<') countl.at(i+1) = countl.at(i) +1;
        else countl.at(i+1) = 0;
    }
    for(int i = n-2;i >= 0;i --){
        if(s.at(i) == '>') countr.at(i) = countr.at(i+1) +1;
        else countr.at(i) = 0;
    }

    for(int i = 0;i < n;i ++){
        a.at(i) = max(countl.at(i),countr.at(i));
    }

    int ans = 0;
    for(int i = 0;i < n;i ++) ans += a.at(i);

    cout << ans << endl;
}


Measured memory_bytes: 12572
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace contest_Csharp
{
    class Program
    {


        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Console.ReadLine();
            var vals = Console.ReadLine().Split(' ')
                .Select(x => long.Parse(x)).ToList();

            long ans = 1;
            foreach (var item in vals)
            {
                checked
                {

                    if (((long)1e18+ans-1) / ans < item)
                    {
                        ans = -1;
                        break;
                    }
                    ans *= item;
                    if (ans == 0)
                        break;
                    if (ans> (long)1e18)
                    {
                        ans = -1;
                        break;
                    }
                }
            }

            if (vals.Any(x => x == 0))
            {
                ans = 0;
            }



            Console.WriteLine(ans);
            Console.Out.Flush();

        }



    }
}




Measured memory_bytes: 41316
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

int main(void){
    int n, k; cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    vector<int> dp(n);
    dp[0] = 0;
    for (int i = 1; i < n; i++)
    {
        int jj = max(0, i-k);
        dp[i] = 1e9+7;
        for (int j = jj; j < i; j++)
        {
            dp[i] = min(dp[i], dp[j]+abs(h[i]-h[j]));
        }
    }
    cout << dp[n-1] << endl;
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    ld T, X;
    cin >> T >> X;
    cout << setprecision(15) << T/X;
}

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

int main(){
  int N;cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  sort(A.begin(),A.end());
  cout<<A.at(N-1)-A.at(0)<<endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string str, inst, p;
    int a, b, q;
    cin >> str >> q;
    
    for(int i=0; i<q; i++){
        cin >> inst;
        if(inst == "replace"){
            cin >> a >> b >> p;
            str = str.substr(0, a) + p + str.substr(b+1);
        }else if(inst == "reverse"){
            cin >> a >> b;
            string sub = "";
            for(int j=b; a<=j; j--){
                sub += str.at(j);
            }
            str = str.substr(0, a) + sub + str.substr(b+1);
        }else if(inst == "print"){
            cin >> a >> b;
            cout << str.substr(a, (b-a+1)) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[3],ans=100000;
  int dif12,dif13,dif23;
  for(int i=0;i<3;i++){
    cin>>a[i];
  }
  dif12=abs(a[0]-a[1]);
  dif23=abs(a[1]-a[2]);
  dif13=abs(a[0]-a[2]);
  ans=min(ans,dif12+dif23);
  ans=min(ans,dif13+dif23);
  ans=min(ans,dif12+dif13);
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
precomputation = [nil]
(1..5).each do |n|
	precomputation << h = Hash.new(0)
	(0..9).to_a.combination(n).map{|t| t.inject(&:+)}.each{|m| h[m] += 1}
end

$<.each_line do |line|
	n, s = line.split.map(&:to_i)
	break if n.zero? and s.zero?

	n, s = 10 - n, 45 - s if 5 < n
	p precomputation[n][s]
end

Measured memory_bytes: 6096
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<string.h>
#include<set>
#include<map>
#define LL long long
#define pr pair<int,int>
#define fr first
#define sc second
//#define mp make_pair
using namespace std;
LL read( ){LL sum=0;char c=getchar( );bool f=0;while(c<'0' || c>'9') {if(c=='-') f=1;c=getchar( );}while(c>='0' && c<='9') {sum=sum*10+c-'0';c=getchar( );}if(f) return -sum;return sum;}
void read(int &sum){sum=0;char c=getchar( );bool f=0;while(c<'0' || c>'9') {if(c=='-') f=1;c=getchar( );}while(c>='0' && c<='9') {sum=sum*10+c-'0';c=getchar( );}if(f) sum=-sum;}
void read(LL &sum){sum=0;char c=getchar( );bool f=0;while(c<'0' || c>'9') {if(c=='-') f=1;c=getchar( );}while(c>='0' && c<='9') {sum=sum*10+c-'0';c=getchar( );}if(f) sum=-sum;}
const int N=300005;
int n,a[N],st[N],L[N],R[N],top;
LL ans;bool TP;
int t[N*8];
void build(int p,int l,int r)
{
  if(l==r) {t[p]=a[l];return;}
  int mid=(l+r)>>1,L=(p<<1),R=L|1;
  build(L,l,mid);build(R,mid+1,r);
  t[p]=max(t[L],t[R]);
}
int ND,ax;
void into(int p,int l,int r)
{
  if(l==r) {ax=l;return;}
  int mid=(l+r)>>1,L=(p<<1),R=L|1;
  if(!TP)
    {
      if(t[R]>ND) into(R,mid+1,r);
      else into(L,l,mid);
    }
  else
    {
      if(t[L]>ND) into(L,l,mid);
      else into(R,mid+1,r);
    }
}
bool ASK(int p,int l,int r,int nl,int nr)
{
  if(l==nl&&r==nr)
    {
      if(t[p]>ND) {into(p,l,r);return 1;}
      return 0;
    }
  int mid=(l+r)>>1,L=(p<<1),R=L|1;
  if(nr<=mid) return ASK(L,l,mid,nl,nr);
  if(nl>mid) return ASK(R,mid+1,r,nl,nr);
  if(!TP)
    {
      if(ASK(R,mid+1,r,mid+1,nr)) return 1;
      if(ASK(L,l,mid,nl,mid)) return 1;
    }
  else
    {
      if(ASK(L,l,mid,nl,mid)) return 1;
      if(ASK(R,mid+1,r,mid+1,nr)) return 1;
    }
  return 0;
}
int main( )
{
  int i,j;
  read(n);
  for(i=1;i<=n;i++) read(a[i]);
  top=0;st[top]=0;
  for(i=1;i<=n;i++)
    {
      while(top&&a[i]>a[st[top]]) top--;
      L[i]=st[top];st[++top]=i;
    }
  top=0;st[top]=n+1;
  for(i=n;i>=1;i--)
    {
      while(top&&a[i]>a[st[top]]) top--;
      R[i]=st[top];st[++top]=i;
    }
  build(1,1,n);
  LL A,B,C,D,X;
  for(i=1;i<=n;i++)
    {
      A=L[i];B=R[i];X=0;ND=a[i];
      TP=0;if(A>1&&ASK(1,1,n,1,A-1)) C=ax;else C=0;
      TP=1;if(B<n&&ASK(1,1,n,B+1,n)) D=ax;else D=n+1;
      if(A!=0) X+=(B-i)*(A-C);
      if(B!=n+1) X+=(D-B)*(i-A);
      ans+=X*a[i];
    }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,k; cin>>n>>k;
  vector<int> x(n);
  for(int i=0; i<n; ++i) cin>>x[i];
  int res=2147483647;
  for(int i=0; i+k-1<n; ++i){
    int left=x[i],right=x[i+k-1];
    res=min(res,min(abs(left),abs(right))+right-left);
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 3784
object Main extends App {
  var Array(a,b,k) = readLine.split(" ").map{_.toLong}
  
  if (a <= k) {
    k -= a
    a = 0
  } else {
    a -= k
    k = 0
  }
  
  if (k > 0) {
    if (b <= k) b = 0 else b -= k
  }
  
  println(s"$a $b")
}

Measured memory_bytes: 25404
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication9
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] str = Console.ReadLine().Split(' ');
            int W = int.Parse(str[0]);
            int H = int.Parse(str[1]);
            int x = int.Parse(str[2]);
            int y = int.Parse(str[3]);
            int r = int.Parse(str[4]);

            if (x - r >= 0 && x + r <= W)
            {
                if (y - r >= 0 && y + r <= H)
                {
                    Console.WriteLine("Yes");
                } else {
                    Console.WriteLine("No");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
           
         

        }
    }
}

Measured memory_bytes: 11352
import bisect

n = int(input())
l_list = list(map(int, input().split()))
l_list.sort()

score = 0
#a_before = 0
#b_before = 0
for i in range(0, n - 2):
  a = l_list[i]
  #if a_before == a:
  #  continue
  #a_before = a
  
  for j in range(i + 1, n - 1):
    b = l_list[j]
    #if b_before == b:
    #  continue
    #b_before = b
    
    #minimum = b - a
    maximum = a + b
    
    #idx_minimum = bisect.bisect_right(l_list, minimum)
    idx_maximum = bisect.bisect_left(l_list, maximum)
    
    score += max(0, idx_maximum - j - 1)
        
print(score)

Measured memory_bytes: 3188
#include<iostream>
using namespace std;
#define END ' '
int main()
{
  string list[10]={
    " ",
    "',.!?",
    "abcABC",
    "defDEF",
    "ghiGHI",
    "jklJKL",
    "mnoMNO",
    "pqrsPQRS",
    "tuvTUV",
    "wxyzWXYZ",
  };
  string s,ans;
  int i,cnt;
  while(cin>>s){
    s+=END;
    ans="";
    cnt=0;
    for(i=1;i<s.size();i++){
      if(s[i-1]==s[i]){
	if(s[i-1]=='0')ans+=' ';
	cnt++;
      }else{
	if(s[i-1]!='0'){
	  int t=s[i-1]-'0';
	  ans+=list[t][cnt%list[t].size()];
	}
	cnt=0;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define itn int

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

    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    a--, b--, c--, d--;

    string s;
    cin >> s;

    if (c < d) {
        for (int i = b + 1; i < d; i++) {
            if (s[i - 1] == '#' && s[i] == '#') {
                cout << "No" << endl;
                return 0;
            }
        }
        for (int i = a + 1; i < c; i++) {
            if (s[i - 1] == '#' && s[i] == '#') {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }

    for (int i = a + 1; i < c; i++) {
        if (s[i - 1] == '#' && s[i] == '#') {
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = b; i <= d; i++) {
        if (0 <= i - 1 && i + 1 < n && s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 592
S = input()

from collections import deque
S = deque(S)
Q = int(input())
query = [input().split() for _ in range(Q)]
reverse = 0
for i in range(Q):
    if query[i][0] == "1":
        reverse += 1
    else:
        if query[i][1] == "1":
            if reverse % 2 != 0:
                S.append(query[i][2])
            else:
                S.appendleft(query[i][2])
        else:
            if reverse % 2 != 0:
                S.appendleft(query[i][2])
            else:
                S.append(query[i][2])

result = "".join(S)
if reverse % 2 != 0:
    result = result[::-1]

print(result)

Measured memory_bytes: 44524
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <map>
#define re register
using namespace std;
typedef long long ll;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

int H,W,n;
struct node { int lx,ly,rx,ry; };
bool operator <(node a,node b) {
    if (a.lx!=b.lx) return a.lx<b.lx;
    else if (a.ly<b.ly) return a.ly<b.ly;
    else if (a.rx<b.rx) return a.rx<b.rx;
    else return a.ry<b.ry;
}
map<node,int> mp;
ll ans[10],sum=0;

int main() {
    H=read(),W=read(),n=read();
    for (re int i=1;i<=n;++i) {
        int x=read(),y=read();
        for (re int dx=-2;dx<=0;++dx) {
            int lx=x+dx,rx=lx+2;
            if (lx<1||lx>H||rx<1||rx>H) continue;
            for (re int dy=-2;dy<=0;++dy) {
                int ly=y+dy,ry=ly+2;
                if (ly<1||ly>W||ry<1||ry>W) continue;
                node t=(node){lx,ly,rx,ry};
                if (!mp.count(t)) mp[t]=1;
                else ++mp[t];
            }
        }
    }
    for (re auto i:mp) ++ans[i.second];
    ans[0]=1ll*(W-2)*(H-2);
    for (re int i=1;i<10;++i) ans[0]-=ans[i];
    for (re int i=0;i<10;++i) printf("%lld\n",ans[i]);
    return 0;
}


Measured memory_bytes: 56448
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int64_t Cost(const vector<int64_t> &vec, int64_t special)
{
    int64_t cost = 0;
    for (const auto &num : vec) {
        cost += abs(num - special);
    }
    return cost;
}

int64_t MinCost(const vector<int64_t> &vec)
{
    int64_t special_min = -1e9;
    int64_t special_max = 1e9;

    while (special_min < special_max) {
        // cerr << special_min << " " << special_max << "\n";
        auto left = special_min + (special_max - special_min) / 3;
        auto right = special_max - (special_max - special_min) / 3;

        auto cost_left = Cost(vec, left);
        auto cost_right = Cost(vec, right);

        if (cost_left < cost_right) {
            special_max = right - 1;
        } else {
            special_min = left + 1;
        }
    }
    return min(Cost(vec, special_min), Cost(vec, special_max));
}

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

    vector<int64_t> vec(n);
    for (int i = 0; i < n; i += 1) {
        cin >> vec[i];
        vec[i] -= (i + 1);
    }

    auto res = MinCost(vec);
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


ll binary_power(ll a, ll n) {
    if (n==0) return 1;
    ll k=binary_power(a,n/2);
    if (n%2==0) return (k*k)%MOD;
    else return (((k*k)%MOD)*a)%MOD;
}


int main() {
    ios_base::sync_with_stdio(false);

    int h,w,k;
    cin >> h >> w >> k;
    vector<vector<ll>> v(h,vector<ll>(w+1));
    rep(i,h) {
        string s;
        cin >> s;
        rep(j,w) v[i][j]=s[j]-'0';
    }
    ll ans=0;
    rep(a,h) {
        rep(b,w) {
            vector<vector<ll>> t(h,vector<ll>(w+1));
            copy(v.begin(),v.end(),t.begin());
            invrep(c,a) t[c+1][b]=t[c][b];
            t[0][b]=0;
            ll tans=0,dans=1,itr=0;
            while (dans>0) {
                dans=0;
                rep(i,h) {
                    int cnt=1;
                    rep(j,w) {
                        if (t[i][j+1]==t[i][j]) ++cnt;
                        else {
                            if (cnt>=k) {
                                dans+=cnt*t[i][j]*binary_power(2,itr);
                                rep(k,cnt) t[i][j-k]=0;
                            }
                            cnt=1;
                        }
                    }
                }
                rep(j,w) {
                    vector<ll> a;
                    rep(i,h) {
                        if (t[i][j]!=0) a.push_back(t[i][j]);
                    }
                    rep(i,h-a.size()) t[i][j]=0;
                    rep(i,a.size()) t[i+h-a.size()][j]=a[i];
                }
                ++itr;
                tans+=dans;
            }
            ans=max(ans,tans);
        }
    }
    
    cout << ans << endl;
    
    return 0;   
}


Measured memory_bytes: 256
///in the name of ALLAH
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll bigmod(ll a,ll b,ll m)
{
    if(b==0)
        return 1%m;
    ll x=bigmod(a,b/2,m);
    x=(x*x)%m;
    if(b%2==1)
        x=(x*a)%m;
    return x;
}
int main()
{
  ll n,mod=1000000007;
  cin>>n;
  ll ans=(bigmod(10,n,mod)-((2*bigmod(9,n,mod))%mod)%mod+bigmod(8,n,mod)%mod+mod)%mod;
  cout<<ans%mod<<endl;

}



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

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

    for (int x=1; x <= sqrt(n); x++) {
        int x2 = x*x;
        for (int y=1; y <= sqrt(n); y++) {
            int y2 = y*y;
            int xy = x*y;
            for (int z=1; z <= sqrt(n); z++) {
                int a = x2 + y2 + z*z + xy + y*z + z*x;
                if (a <= n) ans[a]++;
            }
        }
    }

    for (int i=1; i<=n; i++) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 3488
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<numeric>
#include<algorithm>
#include<limits.h>
#include<utility>
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(i,n,a) for(int i=0;i<n;i++)cin >> a[i]
long long int n;
using namespace std;

int main(){
     string s;
     cin >> s;
     int a[11] = {};
     for(int i=0;i<s.size();i++){
if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
a[i] = 1;
}
     }
     for(int i=1;i<11;i++){
if(a[i] != 0)a[i] += a[i-1];
     }

     //lp(i,11)cout << a[i]<< ' ';
     //cout << endl;
     sort(a,a+11);
     reverse(a,a+11);
     cout << a[0];
          return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>

using namespace std;

bool search(int A[],int n,int key){
    int i=0;
    A[n]=key;
    while(A[i]!=key)i++;
    return i!=n;
}

int main(){
    int i,n,A[10001],q,key,sum=0;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>A[i];
    cin>>q;
    for(i=0;i<q;i++){
        cin>>key;
        if(search(A,n,key))sum++;                          
    }   
    cout<<sum<<"\n";
    return 0;
     
}



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

main()
{
    int n,m; cin>>n>>m;
    if(n&1)
    {
        for(int i=1,j=n; m--; i++,j--)
        {
            cout << i << " " << j << "\n";
        }
    }
    else
    {
        int k=n/2;
        bool flag=false;
        for(int i=1,j=n; m--; i++,j--)
        {
            if(!flag and j-i<=k)
            {
                ++i;
                flag=true;
            }
            cout << i << " " << j << "\n";
        }
    }

}


Measured memory_bytes: 3548
#include <stdio.h>
#include <string.h>


int main(void)
{
    char a[10], b[10], e[10];
    int c, d;
    
    printf("\n");
    scanf("%s", a);
    
    printf("\n");
    scanf("%s", b);
    
    printf("\n");
    scanf("%d", &c);
    
    printf("\n");
    scanf("%d", &d);
    
    printf("\n");
    scanf("%s", e);
    
    /*
    int ret= strcmp(a[10], e[10]);
    
    int ret2= strcmp(b[10], e[10]);
    
     */
    if(!strcmp(a, e))
    {
        printf("%d %d", c-1, d);
    }
    else if(!strcmp(b, e))
    {
        printf("%d %d", c, d-1);
    }
    
    return 0;
}


Measured memory_bytes: 128
import heapq

class Dijkstra:
    """
        Dijkstra's algorithm: find the shortest paths from a vertex
        complexity:
            O(E + logV)
    """
    def __init__(self, V, E, start, INF=10**9):
        """
        :param V: the number of vertices
        :param E: adjacency list (all edge in E must be non negative)
        :param start: start vertex
        :param INF: Infinity distance
        """
        self.V = V
        self.E = E
        self.dijkstra(start, INF)

    def dijkstra(self, start, INF):
        que = list()
        self.distance = [INF] * self.V
        self.prev = [-1] * self.V
        self.distance[start] = 0
        heapq.heappush(que, (0, start))
        while len(que) > 0:
            dist, fr = heapq.heappop(que)
            if self.distance[fr] < dist:
                continue
            for to, cost in self.E[fr]:
                if self.distance[fr] + cost < self.distance[to]:
                    self.distance[to] = self.distance[fr] + cost
                    heapq.heappush(que, (self.distance[to], to))
                    self.prev[to] = fr

    def get_path(self, end):
        path = [end]
        while self.prev[end] != -1:
            end = self.prev[end]
            path.append(end)
            return path[::-1]


V = int(input())
edges = [[] for _ in range(V)]
for _ in range(V):
    u, _, *e = map(int, input().split())
    for t, d in zip(e[::2], e[1::2]):
        edges[u].append((t, d))

djk = Dijkstra(V, edges, 0)
for i, d in enumerate(djk.distance):
    print(i, d)


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

int main(){
 int x;
 cin>>x;
 switch(x%7){
     case 3:cout<<"sun"<<endl; break;
     case 4:cout<<"mon"<<endl; break;
     case 5:cout<<"tue"<<endl; break;
     case 6:cout<<"wed"<<endl; break;
     case 0:cout<<"thu"<<endl; break;
     case 1:cout<<"fri"<<endl; break;
     case 2:cout<<"sat"<<endl; break;
 }   
 return 0;
}


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

int main(){
    long long n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    long long t = min({a, b, c, d, e});
    cout << (n-1) / t + 5 << endl;
    return 0;
}

Measured memory_bytes: 256