akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    int n,m; cin >> n >> m;
    char mat[n][m];
    for(int i=0; i<n; i++) for(int j=0; j<m; j++) cin >> mat[i][j];
    int ans = 0, d = 0;
    int R[] = {-1,0,1,0};
    int C[] = {0,1,0,-1};
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            d = 0;
            vector<vector<bool>> vis(n,vector<bool>(m,false));
            queue<pair<int,int>> q;
            queue<int> dist;
            if(mat[i][j] == '.'){
                q.push({i,j});
                dist.push(d);
                vis[i][j] = true;
                while(!q.empty()){
                    int x = q.front().first;
                    int y = q.front().second;
                    d = dist.front();
                    q.pop();
                    dist.pop();
                    bool check = false;
                    for(int k=0; k<4; k++){
                        int a = x+R[k];
                        int b = y+C[k];
                        if(a >= 0 and a < n and b >= 0 and b < m and mat[a][b] == '.' and !vis[a][b]){
                            if(!check){
                                check = true;
                                d++;
                            }
                            q.push({a,b});
                            dist.push(d);
                            vis[a][b] = true;
                        }
                    }
                }
            }
            ans = max(ans,d);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
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 a,b,k;

int main(){
    cin >> a >> b >> k;
    vector<int> ra(a+1);
    vector<int> rb(b+1);
    
    FOR(i,1,a+1){
        if(a%i==0)ra[i]=1;
    }
    FOR(i,1,b+1){
        if(b%i==0)rb[i]=1;
    }
    int cnt = 0;
    for(int i= min(a,b)+1;i>=1;--i){
        if(ra[i]&&rb[i])cnt++;
        if(cnt==k){
            put(i)
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
a=input()
m=int(a[:2])
u=int(a[2:])
if (m<=12 and m>0) and (u<=12 and u>0):
    print("AMBIGUOUS")
    exit()
elif (m<=12 and m>0) and (u>12 or u==0):
    print("MMYY")
    exit()
elif (m>12 or m==0) and (u<=12 and u>0):
    print("YYMM")
    exit()
    
else:
    print("NA")
    exit()

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

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<ll> Size;
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1);
        for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

    ll size(int x){
        return Size[root(x)];
    }
};

int N, M;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    UnionFind uni(N + M + 1);
    for(int i = 1; i <= N; i++) {
        int K;
        cin >> K;
        while(K--) {
            int l;
            cin >> l;
            uni.merge(i, N + l);
        }
    }
    for(int i = 2; i <= N; i++) {
        if(!uni.issame(1, i)) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 3456
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N,K;
	cin >> N>>K;
 
	// 解法
	double ans = 0;
	REP(i,N){
		ll tmp = i+1;
		ll count = 0;
		while (tmp<K){
			count++;
			tmp *= 2;
		}
		ans += pow(0.5, count)/N;
		// cout<<count<<endl;
	}
	printf("%.16f\n", ans);
}


Measured memory_bytes: 256
let () =
	let arr = Array.make 4 0 in
	Scanf.scanf "%d\n" @@ fun n ->
    for i = 0 to n - 1 do
    	Scanf.scanf "%s\n" @@ fun s -> 
        if s = "AC" then arr.(0) <- arr.(0) + 1
        else if s = "WA" then arr.(1) <- arr.(1) + 1
        else if s = "TLE" then arr.(2) <- arr.(2) + 1
        else arr.(3) <- arr.(3) + 1
    done;
    Printf.printf "AC x %d\n" arr.(0);
    Printf.printf "WA x %d\n" arr.(1);
    Printf.printf "TLE x %d\n" arr.(2);
    Printf.printf "RE x %d\n" arr.(3);

Measured memory_bytes: 5908
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	as := make([]int, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&as[i])
	}

	ds := make([]int, n+1)

	cur := 1
	for i := 1; i <= k; i++ {
		cur = as[cur]
		if ds[cur] == 0 {
			ds[cur] = i
			continue
		}

		d := i - ds[cur]
		if d <= k-i {
			i += (k - i) / d * d
		}
	}

	fmt.Println(cur)
}


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


int main()
{
  int n;
  cin >> n;
  long a[n];
  for(int i = 0; i<n; ++i) cin >> a[i];
  long r = 1e9 + 7;
  long sum = 0;
  for(int i = 0; i<n; ++i){
    sum+=a[i];
  }
  sum %= r;
  sum = (sum * sum) % r;
  
  long s;
  for(int i = 0; i<n; ++i){
    s = a[i]*a[i];
    s %= r;
    sum -= s;
    if(sum < 0) sum+=r;
  }
  if(sum % 2 == 0) sum /= 2;
  else sum = (sum + r)/2;
  cout << sum << endl;
}


Measured memory_bytes: 5184
N, K = map(int, input().split())
X = list(map(int, input().split()))

minus = [0]
plus = [0]
for x in X:
    if x < 0:
        minus.append(abs(x))
    elif x == 0:
        K -= 1
    else:
        plus.append(x)

#負の数の方を絶対値に基づき並べなおす
minus.sort()

a = len(minus) - 1
b = len(plus) - 1

ans = []
for i in range(max(0, K - b), min(a, K) + 1):
    ans.append(min(minus[i] * 2 + plus[K - i], minus[i] + plus[K - i] * 2))

if len(X) == 1:
    ans.append(X[0])

print(min(ans))

Measured memory_bytes: 14480
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


a = int(input())
b = list(map(int, input().split()))
c = 0
for i in b:
    c = g_c_d(c, i)
print(c)


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

int main(){
  int n; cin>>n;
  vector<double> a(n);
  for (int i=0;i<n;++i)cin>>a[i];
  
  sort(a.begin(),a.end());
  
  double ans=0.0;
  
  for(int i=0;i<n-1;++i){
    ans=(a[i]+a[i+1])/2.0;
    a[i+1]=ans;
  }

 cout<<setprecision(15)<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define OUTSIDE_BLOCK '#'
#define INSIDE_BLOCK '.'
#define ARR_LIMIT 10000

typedef struct {
    int width;
    int height;
} Size;

void InputNumber(int* number, int limitLow, int limitHigh);
void Drawing(Size* sizes, int size);

int main(void) {
    int length;
    Size sizes[ARR_LIMIT];

    for (length = 0; length < ARR_LIMIT; length++) {
        int width;
        int height;

        InputNumber(&height, 0, 300);
        InputNumber(&width, 0, 300);

        if (width == 0 && height == 0) {
            break;
        }

        if (width < 3 || height < 3) {
            continue;
        }

        Size size = sizes[length];
        size.width = width;
        size.height = height;
        sizes[length] = size;
    }

    Drawing(sizes, length);

    return 0;
}

void InputNumber(int* number, int limitLow, int limitHigh) {
    int x;
    do {
        scanf("%d", &x);
    } while (x < limitLow || x > limitHigh);
    *number = x;
}

void Drawing(Size* sizes, int length) {

    int idx;
    int idW;
    int idH;

    for (idx = 0; idx < length; idx++) {
        Size size = sizes[idx];

        for (idH = 0; idH < size.height; idH++) {
            for (idW = 0; idW < size.width; idW++) {
                char block = INSIDE_BLOCK;
                if (idH == 0 || idW == 0 || idH == size.height - 1 || idW == size.width - 1) {
                    block = OUTSIDE_BLOCK;
                }
                printf("%c", block);
            }
            printf("\n");
        }
        printf("\n");
    }
}



Measured memory_bytes: 2048
#include<iostream>
#include<queue>
#include<bitset>
#include<cassert>
#include<vector>
#include<algorithm>
#include<climits>
#include<cstdio>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 366

using namespace std;

int dx[] = {+0,+1,+0,-1,+0,+2,+0,-2,+0};
int dy[] = {+1,+0,-1,+0,+2,+0,-2,+0,+0};
int n;
int fest[MAX];
bool visited[MAX][9][7][7][7][7];

bool isValid(int day,int cur)
{
  if((fest[day]>>cur) & 1)return false;
  if((fest[day]>>(cur+1)) & 1)return false;
  if((fest[day]>>(cur+4)) & 1)return false;
  if((fest[day]>>(cur+5)) & 1)return false;
  return true;
}

bool dfs(int day,int cur,int _1,int _3,int _9,int _11)
{
  //cout << day << "," << cur << "," << _1 << "," << _3 << "," << _9 << "," << _11 << endl;

  if(visited[day][cur-(1*(cur/4))][_1][_3][_9][_11])return false;
  visited[day][cur-(1*(cur/4))][_1][_3][_9][_11] = true;

  if(!isValid(day,cur))
    {
      return false;
    }  

  if(day >= n-1)
    {
      return true;
    }

  int x = cur % 4;
  int y = cur / 4;

  rep(i,9)
    {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if(!(0 <= nx && nx <= 2 && 0 <= ny && ny <= 2))continue;
      int next = nx + ny * 4;
      int cost1 = _1+1;
      int cost3 = _3+1;
      int cost9 = _9+1;
      int cost11 = _11+1;
      if(next == 0)cost1 = 0;
      if(next == 2)cost3 = 0;
      if(next == 8)cost9 = 0;
      if(next == 10)cost11 = 0;
      if(cost1 >= 7 || cost3 >= 7 || cost9 >= 7 || cost11 >= 7)continue;
      //cout << "go next (" << day+1 << "," << next << "," << cost1 << "," <<cost3 << "," << cost9 << "," << cost11 << ")\n";
      if(dfs(day+1,next,cost1,cost3,cost9,cost11))
	{
	  return true;
	}
    }
  return false;
}

int main()
{
  while(scanf("%d",&n),n)
    {
      rep(i,n)
	{
	  fest[i] = 0;
	  int schedule;
	  rep(j,16)
	    {
	      scanf("%d",&schedule);
	      if(schedule)
		{
		  fest[i] |= (1<<j);
		}
	    }
	}

      rep(i,n+1)rep(j,9)rep(k,7)rep(l,7)rep(m,7)rep(o,7)
	visited[i][j][k][l][m][o] = false;

      cout << dfs(0,5,1,1,1,1) << endl;

    }
  return 0;
}

Measured memory_bytes: 8956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

//フィボナッチ数 mod p
vll fibmemo(100000, 0);
ll fib(ll n, ll p) {
  if (n == 0) return 0;
  if (n == 1) return 1;
  if (0 <= n && n <= 99999 && fibmemo.at(n) != 0)
    return fibmemo.at(n) % p;
  if (0 <= n && n <= 99999)
    fibmemo.at(n) = fib(n - 1, p) + fib(n - 2, p) % p;
  return fib(n - 1, p) % p + fib(n - 2, p) % p;
}

int main() {
  long long n, m, p = 1000000007;
  cin >> n >> m;
  vector<long long> a(m + 1);
  a.at(0) = - 1;
  for (long long i = 0; i < m; i++) {
    cin >> a.at(i + 1);
    if (i > 0 && a.at(i) + 1 == a.at(i + 1)) {
      cout << 0 << endl;
      return 0;
    }
  }
  a.push_back(n + 1);
  vector<long long> b(m + 1);
  for (long long i = 0; i < m + 1; i++) 
    b.at(i) = a.at(i + 1) - a.at(i) - 1;
  long long cnt = 1;
  for (long long i = 0; i < m + 1; i++) {
    cnt *= fib(b.at(i), p);
    cnt %= p;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 5760
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n, k int
	var r string
	var num []int
	fmt.Scan(&n)
	fmt.Scan(&k)
	for {
		num = append(num, n%k)
		n = n / k
		if n == 0 {
			break
		}
	}

	for j := len(num) - 1; j >= 0; j-- {
		r += strconv.Itoa(num[j])
	}
	fmt.Println(len(r))
}


Measured memory_bytes: 512
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	 char x,y;
	 scanf("%c%*c%c",&x,&y);
	 if(x<y)
	 	 printf("<\n");
	 if(x>y)
	 	 printf(">\n");
	 if(x==y)
	 	 printf("=\n");
return 0;
}



Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BBetweenAAndB {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int a, b, x;
        cin >> a >> b >> x;
        if (a == 0) {
            cout << b / x + 1 << endl;
            return;
        }
        int anum = (a - 1) / x;
        int bnum = b / x;
        cout << bnum - anum << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BBetweenAAndB solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define print(v) for(auto &z:v) cout<<z<<' ';cout<<'\n'
#define hi cout<<'h'<<'i'<<'\n' 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define all(v) v.B,v.E
#define sz(v) (int)((v).size())
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define clk1 clock_t start_time=clock()
#define clk2 cout<<(clock()-start_time)/(double)CLOCKS_PER_SEC
#define clean(arr) memset(arr,0,sizeof(arr))
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)
 const double pi = 3.141592653589793238;
int main()
{
    int n,i,j,t;
    boost;
 
    cin>>n;
    double d=2*pi*n;
    cout<<fixed << setprecision(9)<<d;
 
    return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int answer=0;
  if(s[0]=='1'){
    answer+=1;
  }
  if(s[1]=='1'){
    answer+=1;
  }
  if(s[2]=='1'){
    answer+=1;
  }
  cout<<answer<<endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> lP;
const ll mod = 1000000007;
const ll INF = 1e+14;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define _GLIBCXX_DEBUG

int main(){
    string s,t;
    cin>>s>>t;

    int ssize=s.size();
    int tsize=t.size();
    bool judge=true;
    if(ssize<tsize) judge=false;
    else{
    for(int i=ssize-1;i>=tsize-1;i--){
        judge=true;
        string v=s;
        per(j,tsize){
            if(v[i-j]==t[tsize-j-1]) continue;
            else if(v[i-j]=='?'){
                v[i-j]=t[tsize-j-1];
            }
            else judge=false;

        }
        if(judge){
            s=v;
            break;
        }
    }
    }
    if(!judge) cout<<"UNRESTORABLE"<<endl;
    else{
        rep(i,ssize){
        if(s[i]=='?') s[i]='a';
    }

    cout<<s<<endl;
    }

}


Measured memory_bytes: 3608
#include <iostream>

using namespace std;

typedef long long ll;

void run() {
	ll N;
	ll A, B;
	while(cin >> N >> A >> B) {
		ll old;
		ll ans = 0;
		cin >> old;
		for(int i = 1; i < N; i++) {
			ll news;
			cin >> news;
			ans += min(A * (news - old), B);
			old = news;
		}
		cout << ans << endl;
	}
}
int main(int argc, char *argv[]) {
	run();
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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


int main(){
	ll x,y;
	cin>>x>>y;

	int ans=1;

	for (;;){
		x*=2;
		if(x>y)break;
		ans++;	
	}

	cout<<ans<<endl;

	return 0;
}
	

Measured memory_bytes: 256
import math


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def main():
    N = int(input())
    A = factorization(N)

    C = []
    for a, n in A:
        for i in range(n):
            C.append(math.log10(a))

    C = sorted(C, reverse=True)
    t = sum(C) / 2

    p = 0
    q = 0
    for c in C:
        pp = p + c
        qq = q + c

        tp = abs(t - pp) + abs(t - q)
        tq = abs(t - p) + abs(t - qq)

        if tp < tq:
            p = pp
        else:
            q = qq

    p = int(p) + 1
    q = int(q) + 1

    print(max(p, q))


main()


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

int32_t main()
{
    fastio
        int x; cin>>x;
        cout<<(!x);   
    

    return 0;


}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
	int n;
 
  	if(scanf("%d", &n) == 1);
 
	int guu[100000];
	int ki[100000];

	int gucount = 0;
	int baka = 0;
	int bakavalue = 0;
	int guuindex = 0;

	int kicount = 0;
	int aho = 0;
	int ahovalue = 0;
	int kiindex = 0;

	int input;
	int num;
	int output = 0;

	if(n < 2 || n > 100000 || n % 2 != 0) {
		exit(0);
	}

	if(n == 2) {
        printf("0");
        return 0;
    }

    for(int i = 0; i < 100000; i++) {
        guu[i] = 0;
        ki[i] = 0;
    }

    for(int i = 0; i < n; i++) {
    	if(scanf("%d", &input) == 1);
        num = i % 2;
        if(num == 0) {
            guu[input]++;
        } else {
            ki[input]++;
        }
    }

    for(int i = 0; i < 100000; i++) {
        if(guu[i] != 0) {
            if(gucount < guu[i]) {
            	// 2番目のcount(偶数)
                baka = gucount;
                // 2番目のindex(偶数)
                bakavalue = guuindex;
                // 1番目のcount(偶数)
                gucount = guu[i];
                // 1番目のindex(偶数)
                guuindex = i;
            } else if(baka < guu[i]) {
            	// 2番目のcount(偶数)
                baka = guu[i];
                // 2番目のindex(偶数)
                bakavalue = i;
            }
        }
        
        if(ki[i] != 0) {
            if(kicount < ki[i]) {
                aho = kicount;
                ahovalue = kiindex;
                kicount = ki[i];
                kiindex = i;
            } else if(aho < ki[i]) {
                aho = ki[i];
                ahovalue = i;
            }
        }
    }

    if(guuindex == kiindex) {
    	if((gucount + aho) >= (kicount + baka)) {
    		output = (n / 2 - gucount) + (n / 2 - aho);
    	} else {
    		output = (n / 2 - baka) + (n / 2 - kicount);
    	}
    } else {
    	output = (n / 2 - gucount) + (n / 2 - kicount);
    }

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

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dp[100005];
signed main() {
    int N,M;
    cin >> N >> M;
    vector<vector<int>>ki(N);
    vector<int>A(N);
    for(int i = 0; i < M; i++) {
        int x,y;
        cin >> x >> y;
        x--;y--;
        ki[x].push_back(y);
        A[y]++;
    }
    queue<int>que;
    for(int i = 0; i < N; i++) {
        if(A[i] == 0) {
            que.push(i);
        }
    }
    while(!que.empty()) {
        int X = que.front();
        que.pop();
        for(int i = 0; i < ki[X].size(); i++) {
            A[ki[X][i]]--;
            dp[ki[X][i]] = max(dp[ki[X][i]],dp[X]+1);
            if(A[ki[X][i]] == 0) {
                que.push(ki[X][i]);
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        ans = max(ans,dp[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 10176
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>

const int MaxN = 100000, MaxS = 1000;
const int Mod = 998244353, base = ((long long) 1e18) % Mod;

int N;
int Pw[MaxN + 5];
int Sg[3][MaxN + 5];
std::vector<int> Gr[3][MaxN + 5];
int Buc[3][MaxS + 5];

inline int add(int x, int y) { return (x += y) >= Mod ? x - Mod : x; }
inline int mul(int x, int y) { return 1LL * x * y % Mod; }
inline void inc(int &x, int y = 1) { x = add(x, y); }

void init() {
  scanf("%d", &N);
  Pw[0] = 1;
  for (int i = 1; i <= N; ++i) Pw[i] = mul(Pw[i - 1], base);
  for (int k = 0; k < 3; ++k) {
    int m;
    scanf("%d", &m);
    for (int i = 1; i <= m; ++i) {
      int u, v;
      scanf("%d %d", &u, &v);
      if (u > v) std::swap(u, v);
      Gr[k][u].push_back(v);
    }
  }
}

void getSg(int k) {
  static bool buc[MaxN + 5];
  memset(buc, false, sizeof buc);
  int mx = 0;
  for (int u = N; u >= 1; --u) {
    for (int i = 0; i <= mx; ++i) buc[i] = false;
    mx = 0;
    for (int v : Gr[k][u]) {
      buc[Sg[k][v]] = true;
      mx = std::max(mx, Sg[k][v]);
    }
    for (int i = 0; i <= mx + 1; ++i)
      if (buc[i] == false) {
        Sg[k][u] = i;
        break;
      }
  }
}

void solve() {
  for (int k = 0; k < 3; ++k) getSg(k);
  for (int k = 0; k < 3; ++k)
    for (int i = 1; i <= N; ++i)
      inc(Buc[k][Sg[k][i]], Pw[i]);
  int ans = 0;
  for (int i = 0; i <= MaxS; ++i)
    for (int j = 0; j <= MaxS; ++j) {
      int k = i ^ j;
      inc(ans, mul(mul(Buc[0][i], Buc[1][j]), Buc[2][k]));
    }
  printf("%d\n", ans);
}

int main() {
  init();
  solve();
  return 0;
}

Measured memory_bytes: 14336
h, w = gets.split.map(&:to_i)
a = Array.new(h + 2){Array.new(w + 2, 0)}
1.upto(h) do |i|
  s = "." << gets.chomp
  1.upto(w) do |j|
    a[i][j] = 1 if s[j] == '#'
  end
end
que = []
que << [1, 1]
ans = "Impossible"
while que.size > 0
  i, j = que.shift
  if i == h && j == w
    ans = "Possible"
    break
  end
  if a[i][j + 1] == 1 && a[i + 1][j] == 0 && a[i - 1][j + 1] == 0
    que << [i, j + 1]
  end
  if a[i + 1][j] == 1 && a[i][j + 1] == 0 && a[i + 1][j - 1] == 0
    que << [i + 1, j]
  end
end
puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()


int main(){
  int N,L;cin>>N>>L;
  vector<string> s(N);rep(i,N)cin>>s[i];
  sort(all(s));
  string ans = "";
  rep(i,N) ans+=s[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
const int inf = 1001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

int main(){
	int m = 1000000 + 10;
		vector<int> p;
		for (int i = 0;;i++){
			p.push_back(i * (i + 1) * (i + 2) / 6);
			if (i * (i + 1) * (i + 2) / 6 > m)
				break;
		}

		vector<int> dp(m, inf);
		dp[0] = 0;
		vector<int> odd_dp(m, inf);
		odd_dp[0] = 0;
		rep(i, p.size())
		{
			rep(j,m){
				if (j - p[i] >= 0)
					dp[j] = min(dp[j], dp[j - p[i]] + 1);
				if (p[i] % 2 == 1){
					if (j - p[i] >= 0)
						odd_dp[j] = min(odd_dp[j], odd_dp[j - p[i]] + 1);
				}
			}
		}

	while(true){
		int n;
		cin >> n;
		if (n == 0)
			break;
		cout << dp[n] << " " << odd_dp[n] << endl;
	}

	return 0;
}


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

int main(void)
{
	char str[1 << 15];
	char *tpos;
	int j_count;
	int i_count;

	while (~scanf("%s", str)){
		j_count = i_count = 0;
		tpos = str + 1;
		while ((tpos = strstr(tpos, "OI")) != NULL){
			if (tpos[-1] == 'J') j_count++;
			if (tpos[-1] == 'I') i_count++;
			tpos++;
		}
		printf("%d\n%d\n", j_count, i_count);
	}

	return (0);
}

Measured memory_bytes: 564
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  int n;
  cin >> n;
  double ans = 0;
  REP(i,n){
    double x; str u;
    cin >> x >> u;
    if(u=="JPY"){
      ans += x;
    }else{
      ans += x * 380000;
    }
  }
  printf("%.7f\n",ans);
  return 0;
}


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

namespace ABC138C
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var values = Console.ReadLine().Split(' ').Select(v => decimal.Parse(v)).ToList();
            values.Sort();

            var ans = values[0];
            for(int i = 1; i < values.Count; i++)
            {
                ans = (ans + values[i]) / 2;
            }

            Console.WriteLine(ans);
        }
    }
}


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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h = I()
w = I()
n = I()

if h > w:
    print(math.ceil(n/h))
else:
    print(math.ceil(n/w))
    

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

typedef unsigned long ul;

ul t[8], s;

int main(){
  int T;
  scanf("%d", &T);

  while(T--){
    for(int i = 0; i < 8; i++){
      scanf("%x", &t[i]);
    }
    scanf("%x", &s);

    int carry = 0;
    ul ans = 0;

    for(int i = 0; i < 32; i++){
      ul mask = (1ul << i);
      int sbit = ((s & mask) ? 1 : 0);
      int sum = 0;

      for(int j = 0; j < 8; j++){
        sum += ((t[j] & mask) ? 1 : 0);
      }

      if((sum + carry) % 2 == sbit){ //iツビツッツトツ姪堋つェ0
        carry = (sum + carry) / 2;
      }
      else{ //iツビツッツトツ姪堋つェ1
        carry = (8 - sum + carry) / 2;
        ans += mask;
      }
    }

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

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

using namespace std;

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


int main()
{
    int n;
    long long int sum=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                sum=sum+gcd(gcd(i,j),k);
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
#define ll long long 
const int maxn = 1e5+10;
int n,c,k;
int a[maxn];
int ans;
int main()
{
	scanf("%d%d%d",&n,&c,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	int cur=0;
	int up,tmp;
	while(true)
	{
		cur++;
		if(cur>n) break;
		up=a[cur]+k; ans++; tmp=1;
		while(cur<n&&a[cur+1]<=up&&tmp+1<=c) tmp++,cur++;
	}
	printf("%d",ans);
	return 0;
}

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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define INF 1e16
#define mod 1e9+7


int main() {
  ll n;
  cin>>n;
  ll ans=180*(n-2);
  co(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n,m, k; cin>>n>>m>>k;
    deque<ll> a(n), b(m), p(n+1), q(m+1);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    p[0]=0; q[0]=0;
    rep(i,n) p[i+1]=p[i]+a[i];
    rep(i,m) q[i+1]=q[i]+b[i];
    int ca=0, cb=0;
    while(p[ca+1]<=k && ca<n) ca++;
    ll ans=ca;
    int nn=ca+1;
    rep(i,nn){
        while(p[max((ca-i),0)]+q[cb+1]<=k && cb<m){
            cb++;
        }
        ans=max(ans, (ll)(max((ca-i),0)+cb));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 10104
import java.util.*;

 
class Main {
 
    private static Scanner sc = new Scanner(System.in);
 
    public static void main(String[] args) {
        String s = sc.next();
        String s2 = sc.next();

        //String s = String.valueOf(i);
        int i = Integer.parseInt(s);
        int i2 =Integer.parseInt(s2);
        //System.out.println((s + s).contains(s2) ? "Yes" : "No");
        System.out.println(i+i2/2);
    }
}

Measured memory_bytes: 22484
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n=int(input())
    aa=[]
    for _ in range(n):
        qq=list(map(int, input().split()))
        if qq[0]==0:aa.append(qq[1])
        elif qq[0]==1:print(aa[qq[1]])
        else:aa.pop()

main()


Measured memory_bytes: 13376
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

/*-----------Main-----------*/

func main() {
	a, b, h, m := readF(), readF(), readF(), readF()
	ha := h/12*360 + (m / 60 / 12 * 360)
	ma := m / 60 * 360

	angle := agl(ha, ma)
	ans := a*a + b*b - 2*a*b*math.Cos(angle*math.Pi/180)
	fmt.Println(math.Sqrt(ans))
}

func agl(a, b float64) float64 {
	c := math.Abs(a - b)
	if c > 180 {
		c = 360 - c
	}
	return c
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-2.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


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

#define int long long
#define INF 9223372036854775807
#define M_PI 3.14159265358979323846
#define double long double

int mod = 1e9+7;

int fastPow(int b, int e){int r = 1;while(e){if(e%2 == 1){r*=b;r%=mod;}b*=b;b%=mod;e/=2;}return r;}
int pgcd(int a, int b){ if(a%b == 0) return b; else return pgcd(b, a%b);}
int sign(int a){if(a < 0){ return -1;}if(a == 0) {return 0;}if(a > 0) {return 1;}}
bool isPrime(int a){if(a == 1) {return false;}int f = sqrt(a);for(int i = 2; i<=f; i++){if(a%i == 0){return false;}}return true;}
int toInt(string s){int tot = 0;for(int i = s.size()-1; i >= 0; i--){tot+=((s[i]-'0')%mod)*fastPow(10,i);tot%=mod;}return tot;}
string toString(int a){string s = "";while(a){s = (char)('0'+a%10) + s;a/=10;}return s;}

vector<double> v;
int n;

double memo[3009][3009];

double dp(int index, int left){
    if(n == index){
        if(left) return 0;
        else return 1;
    }
    if(memo[index][left] != -1) return memo[index][left];
    //cout << dp(index+1, left+1)*v[index] << ' ' << dp(index+1, left) << endl;
    if(!left){
        memo[index][left] = dp(index+1, left)*v[index]+dp(index+1, left)*(1-v[index]);
    }
    else memo[index][left] = dp(index+1, left-1)*v[index]+dp(index+1, left)*(1-v[index]);
    return memo[index][left];
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    v.resize(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < 3009; i++){
        for(int j = 0; j < 3009; j++){
            memo[i][j] = -1;
        }
    }
    cout << setprecision(12) << fixed << dp(0, n/2+n%2) << endl;
}


Measured memory_bytes: 141952
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<ll, ll>;
const int mod = 1000000007;

int main(){
  int n, x, l;
  cin >> n;
  vector<P> p(n);
  rep(i, n){
    cin >> x >> l;
    p[i].first=x+l;
    p[i].second=x-l;
  }
  sort(p.begin(), p.end());
  int ans=1;
  ll t=p[0].first;
  repo(i, n-1){
    if(t<=p[i].second){
      t=p[i].first;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
//TO THE GOAT CR7
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mod 1e9+7
#define cr7 ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long ll;
int main(){
	cr7
    int t;
	cin >> t;
	ll sum=0;
	for(int i=1;i<=t;i++){
		if(i%3!=0 && i%5!=0)
			sum+=i;
	}
	cout<<sum<<"\n";
    return 0;
}

Measured memory_bytes: 3652
n = int(input())
l = list(map(int, input().split()))
max_num = 0
max_index = 0
total = 0

for i in range(n):
  if max_num < l[i]:
    max_num = l[i]
    max_index = i

l.pop(max_index)

for i in range(n - 1):
  total += l[i]

if total > max_num: print("Yes")
else: print("No")


Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

from collections import deque

H, W = mi()
S = [input() for _ in range(H)]

d = dp2(-1, W, H)
d[0][0] = 1
que = deque([[0, 0]])

h = [1, 0, -1, 0]
v = [0, -1, 0, 1]

while que != deque():
    i, j = que.popleft()
    for x in range(4):
        di, dj = h[x], v[x]
        if 0 <= i+di < H and 0 <= j+dj < W:
            if S[i+di][j+dj] !='#' and d[i+di][j+dj] == -1:
                d[i+di][j+dj] = d[i][j] + 1
                que.append([i+di, j+dj])

if d[H-1][W-1] == -1:
    print('-1')
else:
    ans = H*W - d[H-1][W-1] - sum([S[i].count('#') for i in range(H)])
    print(ans)

Measured memory_bytes: 3316
/*
username:pallesai
source :UVA online judge
Motto:Code Hard
problem:irreducable basic fractions
*/
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<cstdio>
#include<deque>
#include<bitset>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
using namespace std;
//#include<sai>   tHe lAzY PrOgRmMeR :)
#define rl(T) scanf("%lld",&T)
#define ri(T) scanf("%d",&T)
#define rs(T) scanf("%s",T)
#define rc(T) scanf("%c",&T)
#define loop(i,a,n) for(long long i=a;i<n;i++)
#define loopn(i,n) for(long long i=1;i<=n;i++)
#define ll long long
using namespace std;
int main()
{
	ll n,k;
	rl(n);
	//while(n)
	{
		ll res=k=n;

		for(ll i=2;i*i<=k;i++)
		{
			if(k%i==0)
			   res-=res/i;
			while(k%i==0)
			k/=i;
		}
		if(k>1)
		res-=res/k;
		printf("%lld\n",res);		
	//	rl(n);
	}
	return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()



int main()
{
  int A, B, C, D;

  cin >> A >> B >> C >> D;

  while( A >= 0 || C >= 0 )
  {

    C -= B;
    
    if( C <= 0 )
    {
      cout << "Yes" << endl;
      return 0;
    }

    A -= D;
    
    if( A <= 0 )
    {
      cout << "No" << endl;
      return 0;
    }


  }

}

Measured memory_bytes: 3636
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

struct Node {
	int prev, next;
	bool f;
};

int n, m, q;

Node node[202020];

int main() {
	cin >> n >> m >> q;
	REP(i, n) {
		node[i].prev = (i - 1 + n) % n;
		node[i].next = (i + 1) % n;
		node[i].f = true;
	}
	int cur = 0;
	REP(i, m) {
		int a;
		cin >> a;
		if (a % 2 == 0) {
			REP(j, a) {
				cur = node[cur].next;
			}
		}
		else {
			REP(j, a) {
				cur = node[cur].prev;
			}
		}
		node[cur].f = false;
		node[node[cur].prev].next = node[cur].next;
		node[node[cur].next].prev = node[cur].prev;
		cur = node[cur].next;
	}
	REP(qqq, q) {
		int Q;
		cin >> Q;
		cout << node[Q].f << endl;
	}
}


Measured memory_bytes: 5420
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
int N;
int main(){
    cin>>N;

    cout<<48-N<<endl;

    return 0;

}


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

int main() {
int N;
  cin>>N;
  
  long long a, sum1=0, sum2=0, ans1=0, ans2=0; // ansは操作回数の最小値
  for(int i=1; i<=N; i++){
   cin>>a;    // 各iまでの和の符号を正負交互にするので、
    sum1+=a;  // この問題は各和の奇数番目と偶数番目を操作して、どちらが小さくなるかという話になるの
    sum2+=a;
    if(i%2!=0){ // 各和の奇数番目の操作。正と負の場合に分ける
       if(sum1<=0){ // 和が負なら正にする
         ans1+=1-sum1; // 負の値が正の＋1になる回数分足す
         sum1=1; } // 上記の操作をしたのでsum1=1にする
       if(sum2>=0){ // 和が正なら負にする
         ans2+=1+sum2; // 正の値が負の―1になる回数分足す
         sum2=-1; }  // 上記の操作をしたのでsum2=-1にする
    }
    
    else{ // 各和の偶数番目の操作。正と負の場合に分ける
       if(sum1>=0){ // 和が正なら負にする
         ans1+=1+sum1; // ans1はsum1に初項＋で操作していった場合の操作回数
         sum1=-1; }
       if(sum2<=0){ // 和が負なら正にする
         ans2+=1-sum2; // ans2はsum2に初項―で操作していった場合の操作回数
         sum2=1;  }    
    }  
  }
  
 cout<<min(ans1, ans2);
}


Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>
#include<cstdio>

int v[1500001];
char s[1500001],t[500002];
void Zalgorithm(int N){
  int i=1,j=0,k=0;
  while(i<N){
    while(i+j<N&&s[i+j]==s[j])++j;
    v[i]=j;
    if(!j){
      ++i;
      continue;
    }
    k=1;
    while(v[k]+k<j){
      v[i+k]=v[k];
      ++k;
    }
    i+=k;
    j-=k;
  }
}
int i,j,K,quef[500001],ques[500001],size;
int main(){
  int N,ng=500001,mid;
  std::fgets(t,1000000,stdin);
  std::fgets(s,1000000,stdin);
  while(ng-K>1){
    mid=(ng+K)>>1;
    (s[mid]?K:ng)=mid;
  }
  while(t[i]!='\n'){
    s[K+i]=t[i];++i;
  }
  N=i;
  i+=K;
  int M=N+(K<<1);
  while(i<M){
    s[i++]=t[j++];
    j*=j<N;
  }
  Zalgorithm(M);
  for(i=0;i<N;++i){
    if(v[i+K]<K)ques[size++]=(i+K)%N;
  }
  for(i=0;i<N;++i){
    if(i==size){
      puts("-1");
      return 0;
    }
    if(v[ques[i]+=K]>=K){
      ques[size]=ques[i]%N;
      quef[size++]=quef[i]+1;
    }
  }
  printf("%d\n",quef[N-1]);
}

Measured memory_bytes: 11776
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

vector<int> Zalgo(string s){
    long n = s.size();
    vector<int> a(n);
    int i=1,j=0;
    while(i<s.size()){
        while(i+j<s.size() && s[j]==s[i+j]) ++j;
        a[i] = j;
        if(j==0){ ++i; continue; }
        int k=1;
        while(i+k<s.size() && k+a[k]<j){
            a[i+k]=a[k];
            k++;
        }
        i+=k;
        j-=k;
    }
    return a;
}
signed main(){
    int n; cin >> n;
    string s; cin >> s;
    int out=0;
    rep(i,n){
        string sub=s.substr(i);
        vector<int> ans=Zalgo(sub);
        rep(j,ans.size()){
            if(j==0) continue;
            chmax(out,min(ans[j],j));
        }
    }
    cout << out << endl;
}


Measured memory_bytes: 256