akhauriyash/Code-Regression huggingface dataset:
/*
 *Author : zsenshi
 DP Knapsack  
 *
 */
#include <bits/stdc++.h> //Only for gcc compilers
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define dg(x) cout << #x << ":"<<x<<endl
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl
#define rep(i,begin,end) for(__typeof(end) i = (begin)-((begin) > (end)); i != (end) - ((begin) > (end)); i += 1-2*((begin) > (end)))
#define ll long long 
using namespace std;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vector<pii>> vvpi;
const ll INF = 1e18L+5;
const ll mod = 1e9+7;
void add_self(ll &a, ll b){
  a += b;
  if(a >= mod){
    a -= mod;
  }
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int h,w;
  cin >> h >> w;
  vector<vector<char>> square(h,vector<char>(w));
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> square[i][j];
    }
  }
  vector<vector<ll>> dp(h+1,vector<ll>(w+1,0));
  dp[0][0] = 1;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      for(int r2 : {i,i+1}){
        int c2 = j;
        if(r2 == i)c2 = j + 1;
        if(r2 < h && c2 < w && square[r2][c2] == '.'){
          add_self(dp[r2][c2],dp[i][j]);
        }
      }
    }
  }
  cout << dp[h-1][w-1] << "\n";
}


Measured memory_bytes: 9088
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll N,sum=0;
	cin>>N;
	vector<ll>V;
	vector<ll>ANS;
	rep(i,N){
		ll t;
		cin>>t;
		sum=sum+t;
		V.push_back(sum);
	}
	rep(i,N-1){
		ll t;
		t=abs(V[i]-(V.back()-V[i]));
		ANS.push_back(t);
	}
	sort(ANS.begin(),ANS.end());
	cout<<ANS.front()<<endl;
}

Measured memory_bytes: 4848
from collections import deque, defaultdict
import sys
input=sys.stdin.readline


def solve():
    H, W, K = map(int, input().split())
    y1, x1, y2, x2 = map(int, input().split())
    l = [[1 if s=="@" else 0 for s in input()] for _ in range(H)]
    INF = 10**12

    x1 -= 1
    y1 -= 1
    x2 -= 1
    y2 -= 1

    ddy = [0, 0, -1, 1]
    ddx = [-1, 1, 0, 0]

    dist = defaultdict(lambda :INF)
    dist[(y1, x1)] = 0
    q = deque([(y1, x1)])

    while q:
        y, x = q.popleft()
        for dy, dx in zip(ddy, ddx):
            for j in range(1, K+1):
                ny, nx = y+dy*j, x+dx*j
                if (not (0<=ny<H and 0<=nx<W)) or l[ny][nx] or dist[(ny, nx)] < dist[(y, x)] + 1:
                    break
                if dist[(ny, nx)] > dist[(y, x)] + 1:
                    dist[(ny, nx)] = dist[(y, x)] + 1
                    q.append((ny, nx))
                else:
                    continue

    ans = dist[(y2, x2)]
    print(ans if ans!=INF else -1)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 201040
import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  s <- getLine
  putStrLn $ checkYM s

checkYM [a1,a2,b1,b2]
  |"01"<=aa && aa<="12" && "01"<=bb && bb<="12" = "AMBIGUOUS"
  |"01"<=aa && aa<="12"                         = "MMYY"
  |"01"<=bb && bb<="12"                         = "YYMM"
  |otherwise                                    = "NA"
    where aa = [a1,a2]
          bb = [b1,b2]

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

int base_conversion(int number, int base)
{
    int t = 1, out = 0, r, a, count = 0;
    a = number;
    while (a != 0)
    {
        r = a % base;
        a = a / base;
        out = out + r * t;
        t = t * 10;
        count++;
    }
    return count;
}

int main()
{
    int n, k;
    cin >> n >> k;
    cout << base_conversion(n, k);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string S;
  cin >> S;
  REP(i, S.size()-1) {
    if (S[i] == S[i+1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}

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

namespace ITP1_6_D
{
    class Program
    {
        static void Main(string[] args)
        {
            ////////////////////////////////////////////////////////////////////////////////
            // (n×m)の行列A と (m×1)の列ベクトルb の積は(n×1)の列ベクトルc となる
            // (n×1)の列ベクトルc の i番目の要素c-i をそれぞれ1行に出力する

            // 1行目：n(行)、m(列)
            // 2行目以降のn行：行列Aの要素a-ij
            // n行目以降のm行：ベクトルbの要素b-i
            ////////////////////////////////////////////////////////////////////////////////

            // 1行目を読み込み、行列の行数と列数を取得
            string[] rnk1 = Console.ReadLine().Split(' ');                           
            int n = int.Parse(rnk1[0]);
            int m = int.Parse(rnk1[1]);

            //行列A、ベクトルbの入れ物を作る
            int[,] matrixA = new int[n, m];     //要素数がn×mの2次元配列を宣言
            int[] vectorB = new int[m];         //要素数がm×1のベクトルを宣言

            //行列Aに対する処理
            for (int i = 0; i < n; i++)         //n行分繰り返す
            {
                string[] strA = Console.ReadLine().Split(' ');
                for (int j = 0; j < m; j++)     //m列分繰り返す
                {
                    matrixA[i, j] = int.Parse(strA[j]);
                }
            }

            //ベクトルbに対する処理
            for(int i=0; i<m; i++)
            {
                vectorB[i] = int.Parse(Console.ReadLine());
            }

            //答えを出す処理
            int c;
            for (int i = 0; i < n; i++)
            {
                c = 0;
                for (int j = 0; j < m; j++)
                {
                    c += matrixA[i, j] * vectorB[j];
                }
                Console.WriteLine(c.ToString());
            }
        }
    }
}



Measured memory_bytes: 20004
/*
ex5_3
tomatokan
*/
#include<stdio.h>

int main(void){
    int width,height;
    int cell[100][100]={0};
    char cell_temp='.';
    int good_row[100]={0};
    int n_good_row=0;
    int good_col[100]={0};
    int n_good_col=0;
    scanf("%d",&height);
    scanf("%d",&width);
    for(int i=0;i<height;i++){/*入力の読み取り*/
        for(int j=0;j<width;j++){
            scanf(" %c",&cell_temp);
            if(cell_temp=='#'){
                cell[i][j]=1;
            }
        }
    }
    for(int i=0;i<height;i++){/*黒いマスのある行を記録*/
        for(int j=0;j<width;j++){
            if(cell[i][j]==1){
                good_col[n_good_col]=i;
                n_good_col++;
                break;
            }
        }
    }
    for(int j=0;j<width;j++){/*黒いマスのある列を記録*/
        for(int i=0;i<height;i++){
            if(cell[i][j]==1){
                good_row[n_good_row]=j;
                n_good_row++;
                break;
            }
        }
    }
    for(int i=0;i<n_good_col;i++){/*黒いマスのある列かつ黒いマスのある行にあるマスだけ表示*/
        for(int j=0;j<n_good_row;j++){
            if(cell[good_col[i]][good_row[j]]==1){
                printf("#");
            }else{
                printf(".");
            }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	vector<int> par(n + 1);
	iota(par.begin(), par.end(), 0);
	function<int(int)> root = [&](int a) {
		if (par[a] == a) return a;
		return par[a] = root(par[a]);
	};
	int ans = n - 1;
	for (int i = 0; i < m; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		int pa = root(a), pb = root(b);
		if (pa == pb) continue;
		par[pa] = pb;
		--ans;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 3848
from fractions import gcd

n = int(input())
*A, = map(int, input().split())
L, R = [0]*(n+1), [0]*(n+1)
for i, (a, b) in enumerate(zip(A, A[::-1])):
    L[i+1] = gcd(L[i], a)
    R[i+1] = gcd(R[i], b)
L, R = L[:n], R[:n][::-1]
print(max(gcd(l, r) for l, r in zip(L, R)))

Measured memory_bytes: 16104
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
 
//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ
 
//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π
 
using namespace std;
 
//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 
//#include "./lib/generic/search.h"

//文字列入力した小数値を小数点なくして返す
int changeDoubleToInt(string decimal){ 
    decimal.erase(1, 1); //小数点削除
    int n_decimal = atoi(decimal.c_str()); //c_strでchar*に変換後、atoiでintに変換
    return n_decimal;
}

//最大公約数
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

int main(){
   int a, b;
   cin >> a >> b;
   rep(i, 10000){
       int za = i*8/100;
       int zb = i*10/100;
       if(za==a && zb==b){
           cout << i << endl;
           return 0;
       }
   }
   cout << "-1" << endl;
   return 0;
}

Measured memory_bytes: 3680
#include<stdio.h>
#include<string.h>
int main()
{
	char s[100];
	int a,i,x=0,y=0;
	scanf("%s",s);
	a=strlen(s);
	for(i=0;i<a;i++){
		if(i%2==0){
			if(s[i]=='L') x=1;
		}
		else{
			if(s[i]=='R') y=1;
		}
	}
	if(x==1||y==1) printf("No\n");
	else printf("Yes\n");
	return 0;
}


Measured memory_bytes: 1660
import java.util.*;

import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		sc.close();
		for(i=1;i<=9;i++) {
			if(n<=i*111) {
				break;
			}
		}
		System.out.println(i*111);
	}
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a, b, c;
  cin >> a >> b >> c;
  
  if(a == b && b == c){
    if(a % 2 == 0) cout << -1 << '\n';
    else cout << 0 << '\n';
    return 0;
  }
  
  int count = 0;
  while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
    int d, e, f;
    d = (b + c) / 2;
    e = (c + a) / 2;
    f = (a + b) / 2;
    a = d;
    b = e;
    c = f;
    count++;
  }
  
  cout << count << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
	
int main ()
{
	int a, b;
	std::cin >> a >> b;
	if (a < b)
		std::cout << "a < b" << std::endl;
	else if (a > b)
		std::cout << "a > b" << std::endl;
	else
		std::cout << "a == b" << std::endl;
}

Measured memory_bytes: 3052
#include <iostream>

using namespace std;

int main(void)
{
	int N;
	int a[100005];
	
	cin >> N;
	for(int i = 0; i < N; i++) cin >> a[i];
	
	int min = 100005, max = -1;
	for(int i = 0; i < N; i++){
		if(min > a[i]) min = a[i];
		if(max < a[i]) max = a[i];
	}
	if(max - min >= 2){
		cout << "No" << endl;
		return 0;
	}
	
	if(max == min){
		if(N >= min * 2){
			cout << "Yes" << endl;
		}else if(N == min + 1){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
		return 0;
	}
	
	int min_cnt = 0, max_cnt = 0;
	for(int i = 0; i < N; i++){
		if(a[i] == min) min_cnt++;
		else max_cnt++;
	}
	
	if(min_cnt > max - 1){
		cout << "No" << endl;
		return 0;
	}
	
	if(max_cnt >= (max - min_cnt) * 2){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	return 0;
}
	
	

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

int main() {
    int n;
    cin >> n;
    char s;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        cin >> s;
        if(s == 'Y') ans++;
    }
    if(ans) cout << "Four" << endl;
    else cout << "Three" << endl;


    return 0;
}

Measured memory_bytes: 256
INF = 10 ** 20

n, q = map(int, input().split())
n_t = 1
seg_tree = []


def initRMQ(n):
    global n_t
    while n_t < n:
        n_t *= 2
    for i in range(0, 2*n_t - 1):
        seg_tree.append(2 ** 31 - 1)


def update(k, x):
    k += n_t - 1
    seg_tree[k] = x
    while k > 0:
        k = (k - 1) // 2
        seg_tree[k] = min(seg_tree[k * 2 + 1], seg_tree[k * 2 + 2])


def findMin(a, b):
    return query(a, b+1, 0, 0, n_t)


def query(a, b, k, l, r):
    if r <= a or b <= l:
        return INF
    if a <= l and r <= b:
        return seg_tree[k]
    else:
        vl = query(a, b, k*2 + 1, l, (l + r) // 2)
        vr = query(a, b, k*2 + 2, (l + r) // 2, r)
        return min(vl, vr)


initRMQ(n)
for _ in range(q):
    com, x, y = map(int, input().split())
    if not com:
        update(x, y)
    else:
        print(findMin(x, y))


Measured memory_bytes: 9004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll ans=0;
	ll cnt=0;
	for(ll i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		if(a==b){
			cnt++;
			ans=max(ans,cnt);
		}
		else{
			cnt=0;
		}
	}
	if(ans>=3){
		cout << "Yes";
	}
	else{
		cout <<"No";
	}
	// your code goes here
	return 0;
}

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

using namespace std;

#define LCM(a,b)                (a / __gcd(a,b) ) *b
#define GCD(a,b)                __gcd(a,b)
#define dist(x1,y1,x2,y2)       sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define distl(x1,y1,x2,y2)      sqrtl((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define fRead(x)                freopen(x,"r",stdin)
#define fWrite(x)               freopen (x,"w",stdout)
#define LL                      long long
#define ULL                     unsigned long long
#define pb                      push_back
#define tcase                   cout<<"Case "<<C++<<": ";
#define all(a)                  a.begin(),a.end()
#define Unique(a)               sort(all(a)),a.erase(unique(all(a)),a.end
#define ABS(x)                  ((x)<0?-(x):(x))
#define min3(a,b,c)             min(a,min(b,c))
#define min4(a,b,c,d)           min(a,min(b,min(c,d)))
#define max3(a,b,c)             max(a,max(b,c))
#define max4(a,b,c,d)           max(a,max(b,max(c,d)))
#define PI                      acos(-1.0)
#define ff                      first
#define ss                      second
#define SP(x,y)                 fixed<<setprecision((y))<<(x)
#define FastRead                ios_base::sync_with_stdio(0);cin.tie(NULL);
#define FOR(x, l, r)            for (int x = l; x<=r; ++x)
#define REP(x,r)                for (int x = 0; x <r; ++x)
#define NN                      cout<<"\n";
#define NNN                     cout<<"\n------------------------------\n";
#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())
//***********************************************************************//
//                      SHAHED AHMED, CSE'15, IUT                        //
//***********************************************************************//

LL lim[20020];
LL fix[20020];
LL val[20020];
LL up[20020];

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

    vector<LL> t(n);
    vector<LL> v(n);

    for(LL i=0;i<n;i++) cin>>t[i];
    for(LL i=0;i<n;i++) cin>>v[i];

    LL pos = 0;
    for(LL i=0;i<t.size();i++)
    {
        lim[pos] = min(lim[pos],v[i]);
        up[pos] = v[i];
        while(t[i]--)
        {
            lim[++pos]= v[i];
            up[pos] = v[i];
        }
    }

    fix[0]=1;
    fix[pos]=1;

    double tot=0;
    
    LL increase = 111;

    while(increase--)
    {
        for(LL i=1;i<=pos;i++)
        {
            if(val[i]==val[i-1]+1 && fix[i-1]==1) fix[i]=1;
        }

        for(LL i=pos;i>=1;i--)
        {
            if(val[i]==val[i+1]+1 && fix[i+1]==1) fix[i]=1;
        }

        for(LL i=1;i<=pos;i++)
        {
            if(fix[i]!=1)
            {
                val[i]++;
                tot+=1.0;
                if(val[i]==lim[i]) fix[i]=1;
            }
        }
    }

    for(LL i=1;i<=pos;i++)
    {
        if(val[i]==val[i-1] && val[i]<up[i-1])
        {
            tot+=0.25;
        }
    }

    cout<<SP(tot,20)<<"\n";

}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pi pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

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

signed main(){
  int s,w;
  cin>>s>>w;
  cout<<(w>=s?"unsafe":"safe")<<endl;
  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {

	int n;
	cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
		cin >> p[i];
	int ans = 0;

	sort(p.begin(), p.end());
	for (int i = 0; i < p.size() - 1; i++)
		ans += p[i];
	ans += p[p.size()-1] / 2;
	cout << ans << endl;

	return 0;
}

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

int main()
{
	int a, b;
	cin >> a >> b;

	int result = 0;
	if (6 <= a && a <= 12) {
		result = b / 2;
	}
	else if(13 <= a){
		result = b;
	}

	cout << result << endl;
	
	return 0;
}

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

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;

//atcoder

int main()
{
	int n, m;

	cin>>n>>m;
	int a[n] = {0};
	bool flag[n] = {false};


	int q;
	string s;

	for (int i = 0; i < m; ++i)
	{
		cin>>q>>s;

		q--;

		if(!flag[q])
		{
			if(s=="WA")
				a[q]++;
			else 
				flag[q] = true;
		}
	}

	int penalty = 0, correct = 0;

	for (int i = 0; i < n; ++i)
	{
		if(flag[i]){
			correct++;
			penalty += a[i];
		}
	}

	cout<<correct<<" "<<penalty<<endl;
}

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

using namespace std;

int main( ) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t,n,i;
    double a;
    t = 1;
    while(t--) {
     a = 0;
     cin >> n;
     int arr[n];
     for(i = 0; i < n; i++)
      cin >> arr[i];
     sort(arr, arr + n);
     a = (double) (arr[0] + arr[1]) / 2;
     for(i = 2; i < n; i++) {
      a = (double) (a + arr[i]) / 2;
	 }
	 cout << fixed << setprecision(16);
     cout << a << endl;
    }
    return 0;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// bin全探索でc問題を解く
fn main() {
    // 入力
    let line:String = read();
    let s: Vec<&str> = line.split(' ').collect();
    let h: i32 = s[0].parse().unwrap();
    let w: i32 = s[1].parse().unwrap();
    let k: i32 = s[2].parse().unwrap();
    //println!("{}, {}, {}", h, w, k);

    let mut v: Vec<String> = Vec::new();
    let mut v1: Vec<char> = Vec::new();
    let mut v2: Vec<Vec<char>> = Vec::new();
    let mut count: i32 = 0;
    for _ in 0..h {
        let s: String = read();
        v1 = s.chars().collect();
        v2.push(v1);
    }
    //println!("{}", pow(2, (h + w) - 1) - 1);
    for i in 0..pow(2, h + w - 1) - 1 {
        if calc_black(v2.clone(), i, h as usize, w as usize, k) {
            count += 1;
        }
    }

    // 処理
    // 入力Cに対して渡されたbit列から消す列を計算して黒の数を返す関数

    // 出力
    // countしたresultを出す
    println!("{}", count);
}

// blocksと消す行と列のbit列を計算して#がk個ならtrueを返す
fn calc_black(mut blocks: Vec<Vec<char>>, num:i32, h: usize, w:usize, k: i32) -> bool {
    let mut result_count: i32 = 0;
    // numの2進数化
    for i in 0..calc_keta(num, 2) {
        let index = calc_keta(num & 1 << i, 2);
        if index == 0 {
            continue;
        }
        if index > 0 && index <= h {
            for j in 0..w {
                blocks[index-1][j] = 'r';
            }
        } else {
            for j in 0..h {
                //println!("h={}, w={}, index = {}, num = {}",j, index - h, index, num);
                blocks[j][index - 1 - h] = 'r';
            }
        }
        /*
        match index {
            h_index @ 0..=h => {
                for i in 0..w {
                    blocks[h_index][i] = '#';
                }  
            },
            w_index @ h..=w => {
                for i in 0..h {
                    blocks[i][w_index] = '#';
                }
            },
            _ => (),
        }
        */
    }

    // カウントを取る
    for i in 0..h {
        for j in 0..w {
            if blocks[i][j] == '#' {
                result_count += 1;
            }
        }
    }
    return result_count == k;
}

// baseのp乗
fn pow(base: i32, p: i32) -> i32 {
    let mut result: i32 = base;
    for _i in 0..p {
        result *= base;
    }

    result
}
fn calc_keta(mut num: i32, kisu: i32) -> usize {
    let mut count = 0;
    if num == 0 {
        return 0;
    }
    while num / kisu != 0{
        count += 1;
        num /= kisu;
    }
    count += 1;
    return count;
}

Measured memory_bytes: 2144
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

/* Dijkstra O(NlogM)*/

struct Dijkstra{
  
  typedef ll Type;
  
  int V;
  vector<vector<pair<int,Type> > > G;
  vector<Type> cost;
  
  Dijkstra(int n):
    V(n),G(n,vector<pair<int,Type> >()){}
  
  void add_edge(int u, int v, Type c){
    G[u].push_back({v,c});
  }
  
  Type solve(int s, int g = -1){
    cost.assign(V,-1);
    priority_queue<pair<Type,int> > pq;
    Type max_cost = 0;
    
    pq.push({0,s});
    
    while(pq.size()){
      Type now_cost = pq.top().first;
      int now = pq.top().second;
      pq.pop();
      
      if(cost[now] >= 0) continue;
      
      cost[now] = -now_cost;
      max_cost = max(max_cost, -now_cost);
      
      if(now == g) return -now_cost;
      
      for(int i=0;i<(int)G[now].size();i++){
        pq.push({now_cost-G[now][i].second, G[now][i].first});
      }
    }
    
    return max_cost;
  }
  
};

int main(){
  int n, m, s, t;
  
  scanf("%d%d%d%d", &n, &m, &s, &t);
  s--; t--;

  Dijkstra dijk(n), dijk2(n);

  for(int i=0;i<m;i++){
    int u, v, a, b;
    scanf("%d%d%d%d", &u, &v, &a, &b);
    u--; v--;

    dijk.add_edge(u,v,a);
    dijk.add_edge(v,u,a);
    dijk2.add_edge(u,v,b);
    dijk2.add_edge(v,u,b);
  }

  dijk.solve(s);
  dijk2.solve(t);

  ll money = 1e15;
  
  ll ans[SIZE] = {};
  
  for(int i=n-1;i>=0;i--){
    ans[i] = max(ans[i+1], money - dijk.cost[i] - dijk2.cost[i]);
  }

  for(int i=0;i<n;i++){
    printf("%lld\n", ans[i]);
  }
  
  return 0;
}



Measured memory_bytes: 19028
#include<iostream>
#include<string>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int main()
{
	string A, B, C;
	cin >> A >> B >> C;
	if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) {
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
const int mod = 1000000007;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
using namespace std;
ll gcd(ll x, ll y) {
	if (max(x, y) % min(x, y) == 0)return min(x, y);
	else return gcd(max(x, y) % min(x, y), min(x, y));
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
int main() {
	ll x, y;
	cin >> x >> y;
	if (x%y == 0)cout << -1 << endl;
	else cout << (lcm(x, y)+x<=1000000000000000000?lcm(x,y)+x:-1)<< endl;
	return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
sum0 = []
sum1 = []
sum2 = []
sum3 = []
sum4 = []
sum5 = []
sum6 = []
sum7 = []

for i in range(a):
  x, y, z = map(int, input().split())
  sum0.append((x + y + z))
  sum1.append((x + y - z))
  sum2.append((x - y + z))
  sum3.append((x - y - z))
  sum4.append((- x + y + z))
  sum5.append((- x + y - z))
  sum6.append((- x - y + z))
  sum7.append((- x - y - z))

sum0 = sum(sorted(sum0, reverse=True)[:b])
sum1 = sum(sorted(sum1, reverse=True)[:b])
sum2 = sum(sorted(sum2, reverse=True)[:b])
sum3 = sum(sorted(sum3, reverse=True)[:b])
sum4 = sum(sorted(sum4, reverse=True)[:b])
sum5 = sum(sorted(sum5, reverse=True)[:b])
sum6 = sum(sorted(sum6, reverse=True)[:b])
sum7 = sum(sorted(sum7, reverse=True)[:b])


print(max([sum0,sum1,sum2,sum3,sum4,sum5,sum6,sum7]))

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

using namespace std;
string s;
long long ans;
int main()
{
    cin>>s;
    long long lg=0;
    for(int i=0;i<s.size();i++)
    {
        long long lg1=0;
        long long lg2=0;
        int j=i;
        while(j<s.size()&&s[j]=='<')
        {
            lg1++;
            j++;
        }
        while(j<s.size()&&s[j]=='>')
        {
            lg2++;
            j++;
        }
        i=j-1;
        long long nrmax=max(lg1,lg2);
        ans+=nrmax;
        ans+=(lg1-1)*lg1/2;
        ans+=(lg2-1)*lg2/2;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 900
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int n, d;

	std::cin >> n >> d;
	if(n % (d * 2 + 1) == 0)
		std::cout << (n / (d * 2 + 1)) << std::endl;
	else
		std::cout << (n / (d * 2 + 1)) + 1 << std::endl;
	return 0;
}

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

int main()
{
    int n,i;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    double ans;
    for(i=0;i<n;i++)
    {
        ans+=1/(double)a[i];
    }
    ans=1/ans;
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
#define int long long
signed main(void){
    int N;
    cin>>N;
    int c=1;
    for(int i=1;i<=100000&&i*i<=N;i++){
        int A=i;
        int B=N/i;
        if(A*B!=N)continue;
        c=log10(B+1.0)+1;
      //  cout << ">>"  << A << "  "<< c <<endl;
        
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
//JSD
#include<iostream>
using namespace std;
int main(){
	int n,m; cin>>n>>m;
	int has[100]={0};
	for(int i=0;i<n;i++){
		int k,x;
		cin>>k;
		for(int j=0;j<k;j++){
			cin>>x;
			has[x]++;
		}
	}
	int count=0;
	for(int i=0;i<100;i++){
		if(has[i]>=n){
			count++;
		}
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main() {
    set<int> s,t;
    bool ans=1;
    int n,m;
    cin>>n;
    rep(i,n){
        int a;
        cin>>a;
        s.insert(a);
    }
    cin>>m;
    rep(i,m){
        int a;
        cin>>a;
        t.insert(a);
    }
    irep(i,t){
        ans&=s.count(*i);
    }
    fin(ans);
}




Measured memory_bytes: 21876
import scala.io.StdIn.readLine

object Main extends App {
  val Array(a, b) = readLine().split(" ").map(_.toInt)
  println(gcd(a, b))
  
  def gcd(x: Int, y: Int): Int = {
    if (y == 0) return x
    gcd(y, x%y)
  }
}



Measured memory_bytes: 43924
package main

import (
	"fmt"
	"os"
	"strconv"
)

// https://atcoder.jp/contests/abc157/tasks/abc157_c

/*
N <= 3 なら全探索
答えとなる数は[0,999]の範囲に収まる。
なので、答えとなる数を小さい方から順番に確認していき、条件を満たすものがあれば答える。
判定の実装では、C++だとto_stringを使うと色々楽にできる。
intとstringにすると速度は犠牲になるが、実装（特に桁に対する実装）は楽になる。
今回は、制約も全部ちっちゃいので、多少無理しても問題ない。

ok := 条件を満たすか
というのを更新しながら判定する。
条件はすべて満たしている必要があるので、満たさないものがあればok = falseとするよう実装する。
判定問題では自分はよく使う記法だ。
*/

func main() {
	var N, M int

	fmt.Scanf("%d", &N)
	fmt.Scanf("%d", &M)

	scPairs := make([]pair, 0, M)

	for si := 0; si < M; si++ {
		var s, c int
		fmt.Scanf("%d", &s)
		fmt.Scanf("%d", &c)

		newPair := pair{si: s, ci: c}
		scPairs = append(scPairs, newPair)
	}

	//N <= 3 なら全探索 答えとなる数は[0,999]の範囲に収まる。
	// なので、答えとなる数を小さい方から順番に確認していき、条件を満たすものがあれば答える。
	for i := 0; i < 1000; i++ {
		s := strconv.Itoa((i))
		if len(s) != N {
			continue
		}
		ok := true
		// check ans by bit
		for j := 0; j < M; j++ {
			for si := 1; si <= N; si++ {
				if i == 702 || i == 170 {
					//fmt.Println("702")
				}
				pair := scPairs[j]
				ci := pair.get(si)
				if ci == -1 {
					continue
				}
				// bit走査 i/1, i/10, i/100....をチェック
				if s[si-1:si] != strconv.Itoa(ci) { // siciに合致しないなら判定式をくつがえす
					ok = false
				}
			}
		}
		if ok {
			fmt.Println(i)
			os.Exit(0)
		}
	}
	fmt.Println("-1")
}

type pair struct {
	si int
	ci int
}

func (p pair) get(key int) int {
	if key == p.si {
		return p.ci
	}
	return -1
}


Measured memory_bytes: 1836
s = STDIN.readline.strip

atcg = ['A', 'T', 'C', 'G']
len = 0
maxlen = 0
s.chars do |c|
  if atcg.include? c
    len += 1
  else
    if len > 0 && maxlen < len
      maxlen = len
    end
    len = 0
  end
end

if len > 0 && maxlen < len
  maxlen = len
end

puts maxlen

Measured memory_bytes: 3836
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    string t = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";

    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < t.size(); j++) {
            if (s[i] == t[j]) {
                s[i] = t[j + n];
                break;
            }
        }
    }

    cout << s << endl;
    
    return 0;
}

Measured memory_bytes: 256
n=int(input())
lists=list(map(int,input().split()))
lists=sorted(lists)
sums=0
uselist=[0]*(n+1)
for i in range(n):
    sums+=lists[i]
    uselist[i]=sums
uselist[n]=0

count=0
for i in range(n):
    if uselist[-(i+1)]<=uselist[-(i+2)]*3:
        count+=1
    else:
        break
print(count)
    

Measured memory_bytes: 14320
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> doup;

int main(void) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll x3, y3, x4, y4;
    
    if(a<=c && b<=d) {
        x4=a-(d-b);
        y4=b+(c-a);
        x3=c-(d-b);
        y3=d+(c-a);
    }else if(c<=a && d<=b) {
        x3=c+(b-d);
        y3=d-(a-c);
        x4=a+(b-d);
        y4=b-(a-c);
    }else if(c<=a && d>=b) {
        x4=a-(d-b);
        y4=b-(a-c);
        x3=c-(d-b);
        y3=d-(a-c);
    }else {
        x3=c+(b-d);
        y3=d+(c-a);
        x4=a+(b-d);
        y4=b+(c-a);
    }
    
    cout << x3 << " " << y3 << " " <<  x4 << " " << y4 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y) {
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll m,n;
  cin >> m >> n;
  cout << m * (m-1) / 2 + n * (n-1) / 2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    int K;
    char S[100];

    scanf("%d",&K);
    scanf("%s", S);
    if(K>=strlen(S)){
        printf("%s",S);
    }else{
        for(int i=0; i<K; i++){
            printf("%c",S[i]);
        }
        printf("...");
    }
    
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
int n,m;
int quickly__power(int x)
{
	int temp;
	temp=1;
	for(int i=1;i<=x;i++)
	  temp*=2;
	return temp;
} 
int main()
{
    cin>>n>>m;
    cout<<(1900*m+100*(n-m))*(quickly__power(m))<<endl; 
    return 0;
}

Measured memory_bytes: 256
s=input()
count=0 
if(s[0]==s[1]==s[2]=='R'):
    print('3')
elif(s[0]==s[1]==s[2]=='S'):
    print('0')
elif(s[0]==s[1]=='R' and s[2]=='S'):
    print('2')
elif(s[1]==s[2]=='R' and s[0]=='S'):
    print('2')
else:
    print('1')
    

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

int H,W,C;

int P[10][10];
int ans;

void draw(int col){
    int tar=P[0][0];
    bool used[10][10]={};
    queue<pair<int,int>> Q;
    Q.push(mkp(0,0));
    used[0][0]=true;
    while(!Q.empty()){
        int x,y;
        tie(x,y)=Q.front();
        Q.pop();

        P[x][y]=col;

        if(x+1<H&&used[x+1][y]==false&&P[x+1][y]==tar){
            used[x+1][y]=true;
            Q.push(mkp(x+1,y));
        }
        if(y+1<W&&used[x][y+1]==false&&P[x][y+1]==tar){
            used[x][y+1]=true;
            Q.push(mkp(x,y+1));
        }
        if(x-1>=0&&used[x-1][y]==false&&P[x-1][y]==tar){
            used[x-1][y]=true;
            Q.push(mkp(x-1,y));
        }
        if(y-1>=0&&used[x][y-1]==false&&P[x][y-1]==tar){
            used[x][y-1]=true;
            Q.push(mkp(x,y-1));
        }
    }
}

int count(){
    int tar=P[0][0];
    bool used[10][10]={};
    queue<pair<int,int>> Q;
    Q.push(mkp(0,0));
    used[0][0]=true;
    int res=0;
    while(!Q.empty()){
        int x,y;
        tie(x,y)=Q.front();
        Q.pop();

        res++;

        if(x+1<H&&used[x+1][y]==false&&P[x+1][y]==tar){
            used[x+1][y]=true;
            Q.push(mkp(x+1,y));
        }
        if(y+1<W&&used[x][y+1]==false&&P[x][y+1]==tar){
            used[x][y+1]=true;
            Q.push(mkp(x,y+1));
        }
        if(x-1>=0&&used[x-1][y]==false&&P[x-1][y]==tar){
            used[x-1][y]=true;
            Q.push(mkp(x-1,y));
        }
        if(y-1>=0&&used[x][y-1]==false&&P[x][y-1]==tar){
            used[x][y-1]=true;
            Q.push(mkp(x,y-1));
        }
    }
    return res;
}

void rec(int num){
    int pre[10][10]={};
    for(int i=0;i<H;i++) for(int j=0;j<W;j++) pre[i][j]=P[i][j];

    if(num==5){
        draw(C);
        ans=max(ans,count());
    }else{
        for(int k=1;k<=6;k++){
            draw(k);
            rec(num+1);
            for(int i=0;i<H;i++) for(int j=0;j<W;j++) P[i][j]=pre[i][j];

        }
    }

    for(int i=0;i<H;i++) for(int j=0;j<W;j++) P[i][j]=pre[i][j];
}

void solve(){
    ans=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>P[i][j];
        }
    }

    rec(1);
    cout<<ans<<endl;
}

int main(){
  while(1){
      cin>>H>>W>>C;
      if(H==0&&W==0&&C==0) break;
      solve();
  }

  return 0;
}


Measured memory_bytes: 3100
//#include <algorithm>
//#include <iostream>
//#include <cstring>
//#include <cstdlib>
//#include <cstdio>
//#include <cmath>
//#include <queue>
//#include <set>
//#include <map>
//#define N 1005

#include <bits/stdc++.h>

using namespace std;

int num[100005];

bool comp(int a, int b)
{
    return a > b;
}
int main()
{
    int n;
    scanf("%d", &n);

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

    sort(num, num + n, comp);

    int a = 0, b = 0, a1 = 0, b1 = 0;

    for(int i = 1; i < n; i++)
    {
        if(a1 == 0 && num[i] == num[i - 1] )
        {
            a1 = 1;
            a = num[i];
            i++;
        }
        else if(a1 == 1 && b1 == 0 && num[i] == num[i - 1])
        {
            b1 = 1;
            b = num[i];
        }

        if(a1 == 1 && b1 == 1)
        {
            break;
        }
    }
    printf("%lld\n",(long long)a*b);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll a, b, c,x;
  cin >> a >> b >> c>>x;
  ll count = 0;
  rep(i,a+1){
    rep(j,b+1){
      rep(k,c+1){
        ll sum = 500 * i + 100 * j + 50 * k;
        if(sum==x){
          count++;
        }
      }
    }
  }
  print(count);
}


Measured memory_bytes: 256
using System;
 
namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            var output = new System.Text.StringBuilder(200000);
            int count = 0;
            for(string input; (input = Console.ReadLine()) != "0"; output.AppendLine("Case " + ++count + ": " + input));
            Console.Write(output.ToString());
        }
    }
}

Measured memory_bytes: 6436
#include <bits/stdc++.h>
#include <atcoder/all>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
  
  int t;cin >> t;
  rep(aa,t){
    int n,m,a,b;cin >> n >> m >> a >> b;
    cout << floor_sum(n,m,a,b) << endl;
  }
}

Measured memory_bytes: 3688
use std::io;
fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let len: usize = s.len() + 1;
    let ch = s.chars().collect::<Vec<char>>();
    let mut left = vec![0; len];
    let mut count_left: u64 = 0;
    let mut count_right: u64 = 0;
    for i in 1..len {
        if ch[i - 1] == '<' {
            count_left += 1;
        } else {
            count_left = 0;
        }
        left[i] = count_left;
    }
    for i in (0..len - 1).rev() {
        if ch[i] == '>' {
            count_right += 1;
        } else {
            count_right = 0;
        }
        left[i] = std::cmp::max(left[i], count_right);
    }
    let ans: u64 = left.into_iter().sum();
    println!("{}", ans);
}


Measured memory_bytes: 10492
def main
  a, b, c, d = ARGF.gets.chars.map(&:to_i)

  s = if a+b+c+d == 7
        "#{a}+#{b}+#{c}+#{d}=7"
      elsif a+b+c-d == 7
        "#{a}+#{b}+#{c}-#{d}=7"
      elsif a+b-c+d == 7
        "#{a}+#{b}-#{c}+#{d}=7"
      elsif a+b-c-d == 7
        "#{a}+#{b}-#{c}-#{d}=7"
      elsif a-b+c+d == 7
        "#{a}-#{b}+#{c}+#{d}=7"
      elsif a-b+c-d == 7
        "#{a}-#{b}+#{c}-#{d}=7"
      elsif a-b-c+d == 7
        "#{a}-#{b}-#{c}+#{d}=7"
      elsif a-b-c-d == 7
        "#{a}-#{b}-#{c}-#{d}=7"
      else
        "error"
      end
  puts s
end

if __FILE__ == $0
  main
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int A, B, C;
	cin >> A >> B >> C;

	if (A == B) cout << C << endl;
	else if (B == C) cout << A << endl;
	else cout << B << endl;
}


Measured memory_bytes: 3600
MOD = 10**9 + 7
from collections import Counter
n = int(input())
a = [int(item) for item in input().split()]
cnt = Counter(a)

if n % 2 == 1:
    for i in range(n//2):
        if i == 0:
            if cnt[i] != 1:
                print(0)
                exit()
        else:
            if cnt[i*2] != 2:
                print(0)
                exit()
    print(pow(2, len(cnt)-1, MOD))
else:
    for i in range(n//2):
        if cnt[1 + i*2] != 2:
            print(0)
            exit()
    print(pow(2, len(cnt), MOD))

Measured memory_bytes: 14892
#include<bits/stdc++.h>
#include<climits>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 100005
#define M 10005
#define INF 1000000000000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-7
using namespace std;
inline int Max(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^b;
}
inline int Min(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^a;
}
int is_mul_overflow(ll a, ll b) {
        return LLONG_MAX / a < b;
}

ll x[N];
ll dp[N],a[4*N],b[4*N];
ll n,e,t;
ll get(int a,int b)
{
    ll d = x[b]-x[a];
    return t>2LL*d?t+d:3LL*d;
}

void push_up(int rt)
{
    a[rt] = min(a[rt<<1],a[rt<<1|1]);
    b[rt] = min(b[rt<<1],b[rt<<1|1]);
}
void build(int l,int r,int rt)
{
    a[rt] = b[rt] = INF;
    if(l == r)return;
    int mid = (l+r)>>1;
    build(l,mid,rt<<1);
    build(mid+1,r,rt<<1|1);
}

void update(int l,int r,int rt,int p,ll x,int f)
{
    if(l == r)
    {
        if(f)a[rt] = min(a[rt],x);
        else b[rt] = min(b[rt],x);
        return;
    }
    int mid = (l+r)>>1;
    if(p<=mid)update(l,mid,rt<<1,p,x,f);
    else update(mid+1,r,rt<<1|1,p,x,f);
    push_up(rt);
}
ll query(int l,int r,int rt,int L,int R,int f)
{
    if(L>R)return INF;
    if(L<=l&&R>=r)return f?a[rt]:b[rt];
    int mid = (l+r)>>1;
    ll ret = INF;
    if(L<=mid)ret = min(ret,query(l,mid,rt<<1,L,min(mid,R),f));
    if(R>mid)ret = min(ret,query(mid+1,r,rt<<1|1,max(L,mid+1),R,f));
    return ret;
}
int get(int p)
{
    int l = 0,r = p;
    while(l<r-1)
    {
        int mid = (l+r)>>1;
        if(2*(x[p]-x[mid+1])>=t)l = mid;
        else r = mid;
    }
    return l;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    while(cin>>n>>e>>t)
    {
        FOR(i,1,n)cin>>x[i];
        FOR(i,0,n)dp[i] = INF;
        build(1,n,1);
        x[0] = 0;
        dp[0] = 0;
        FOR(i,1,n)
        {
            int ps = get(i);
            dp[i] = min(dp[i],t+x[i]+query(1,n,1,ps+1,i-1,1));
            dp[i] = min(dp[i],3*x[i]+query(1,n,1,1,ps,0));
            dp[i] = min(dp[i],x[1]-x[0]+get(1,i));
            update(1,n,1,i,dp[i]-x[i],1);
            update(1,n,1,i,dp[i]-2*x[i+1]-x[i],0);
        }
        cout<<dp[n]+e-x[n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    string S;
    cin >> S;
    S[3]='8';
    
    cout << S << endl;
    
	return 0;
}

Measured memory_bytes: 256