akhauriyash/Code-Regression huggingface dataset:
n = int(input())
lst = []
for i in range(n):
    s = input()
    if i==0:
        text = s
        lst.append(s)
        continue
    else:
        if s in lst or text[-1] != s[0]:
            print('No')
            exit()
        else:
            text = s
            lst.append(s)
print('Yes')

Measured memory_bytes: 3060
n = input()
a = input().split()
b = input().split()
ans = 0
aa = 0
plus = []
def list_sum(l):
    r = 0
    for i in l:
        r += int(i)
    return r

if not list_sum(a) >= list_sum(b):
    print(-1)
else:
    for i in range(int(n)):
        if int(a[i]) < int(b[i]):
            ans += 1
            aa += int(b[i]) - int(a[i])
        else:
            plus.append(int(a[i]) - int(b[i]))
    plus = sorted(plus,reverse=True)
    for i in plus:
        if aa <= 0:
            break
        aa = aa - i
        ans += 1
    print(ans)

Measured memory_bytes: 20184
#include<iostream>
#include<algorithm>
int n,k,ans=1;
main(){
    std::ios::sync_with_stdio(0),std::cin.tie(0),std::cin>>n>>k;
    for(register int i=1;i<=n;++i)ans+=std::min(ans,k);
    std::cout<<ans<<'\n';
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var m, d int
	fmt.Scan(&m, &d)

	ans := 0
	for i := 10; i <= d; i++ {
		d1, d2 := i/10, i%10
		if d1 >= 2 && d2 >= 2 && d1*d2 <= m {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1768
#include<bits/stdc++.h>
#define int long long
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define REP rep
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
const ll MOD=1e9+7;

#define rall(X) (X).rbegin(),(X).rend()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}

const LL INF = 1LL << 62;

int N;
LL E, T;
LL x[114514];
LL d[114514];
LL dp[114514];

signed main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);

  cin >> N >> E >> T;
  reps(i, 1, N+1) {
    cin >> x[i];
  }

  rep(i, N) {
    d[i] = x[i+1] - x[i];
  }

  fill(dp, dp+N+1, INF);
  dp[0] = 0;
  multiset<LL> ones, threes;
  ones.insert(T);

  priority_queue<pll, vector<pll>, greater<pll>> evs;
  evs.push(pll(2*(x[0]+d[0])+T, 0));
  reps(i, 1, N+1) {
    while (!evs.empty() && evs.top().X <= x[i]*2) {
      auto p = evs.top(); evs.pop();
      int idx = p.Y;
      auto itr = ones.find(dp[idx]+T-x[idx]);
      assert(itr != ones.end());
      ones.erase(itr);
      threes.insert(dp[idx]-(3*x[idx]+2*d[idx]));
    }

    if (!ones.empty()) {
      MN(dp[i], x[i]+*ones.begin());
    }

    if (!threes.empty()) {
      MN(dp[i], 3*x[i]+*threes.begin());
    }

    ones.insert(dp[i]+T-x[i]);
    evs.push(pll(2*(x[i]+d[i])+T, i));
  }
  printf("%lld\n", dp[N] + E - x[N]);
}


Measured memory_bytes: 7924
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int n, k;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        k = sc.nextInt();
        solve();
    }

    void solve() {
        int ans = k;
        for (int i = 1; i < n; i++) {
            ans *= k - 1;
        }
        System.out.println(ans);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 22484
/* Simplicity and Goodness */

#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;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;


void solve()
{
    int n;
    scn(n);

    vector<double> dp(n+1);
    // dp[i] : prob. of i heads so far

    dp[0] = 1;

    for(int coins = 0; coins < n; coins++) {
        double p_head;
        scanf("%lf", &p_head);

        for(int i = coins + 1; i >= 0; i--) {
            dp[i] = (i == 0? 0: dp[i-1] * p_head) + dp[i] * (1 - p_head);
        }   
    } 

    double ans = 0;

    for(int i=(n+1)/2; i<=n; i++) {
        ans += dp[i];
    }

    printf("%.12lf", ans);
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3860
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    long long a,b,k;

    cin >>a >>b >>k;

    if(a > k){
        a -= k;
        k = 0;
    }else{
        k -= a;
        a = 0;
    }
    if(b > k){
        b -= k;
        k = 0;
    }else{
        k -= b;
        b = 0;
    }

    printf("%lld %lld\n", a, b);

    return 0;
}

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

int main(void) {
  int N, D;
  
  cin >> N >> D;

  int num = N / (2*D+1);
  int amari = N % (2*D+1);
  
  if(amari != 0) {
    cout << num + 1 << endl;
    return 0;
  }
  cout << num << endl;
  
  return 0; 
}

Measured memory_bytes: 256
#include <cassert>
#include <cstddef>
#include <utility>
#include <vector>

class UnionFind {

public:
	using difference_type = std::ptrdiff_t;
	using container_type = std::vector<difference_type>;
	using size_type = typename container_type::size_type;

private:
	container_type c;

public:
	explicit UnionFind(const size_type size) : c(size, -1) {}

	size_type size() const { return c.size(); }
	bool empty() const { return c.empty(); }

	size_type find(const size_type x) {
		assert(x < size());
		if (c[x] < static_cast<difference_type>(0))
			return x;
		return c[x] = static_cast<difference_type>(find(c[x]));
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return static_cast<size_type>(-c[find(x)]);
	}

	bool unite(size_type x, size_type y) {
		assert(x < size());
		assert(y < size());
		x = find(x);
		y = find(y);
		if (x == y)
			return false;
		if (c[x] > c[y])
			std::swap(x, y);
		c[x] += c[y];
		c[y] = static_cast<difference_type>(x);
		return true;
	}
};

#include<iostream>

int main() {
	int n, q;
	std::cin >> n >> q;
	UnionFind T(n);
	while (q--) {
		int p, a, b;
		std::cin >> p >> a >> b;
		if (p)
			std::cout << (T.same(a, b) ? "1" : "0") << std::endl;
		else
			T.unite(a, b);
	}
	return 0;
}



Measured memory_bytes: 3180
#include <stdio.h>

#define INF 1000000000

int R[101][101]; // 0:root is not exist 1:root exist
int d[101]; // reserve a distant from start
int color[101]; // 0:white 1:gray 2:black
int nm;

struct queue
{
	int arr[100];
	int first;			//次にDEQする配列の添え字
	int last;			//次にENQする配列の添え字
};

struct queue Q;

int enq(int input)
{
	if (Q.arr[Q.last] == 0) { 
		Q.arr[Q.last] = input;
		Q.last++;
		return 0;
	}
	else
	{
		printf("これ以上データを追加できません。\n");
		return -1;
	}
}

int deq()
{
	int output = Q.arr[Q.first];

	if (output != 0)
	{
		Q.arr[Q.first] = 0;
		Q.first++;
		return output;
	}
	else
	{
		printf("データがありません。\n");
		return -1;
	}
}

void init_queue(struct queue que)
{
	int i;

	for (i = 0; i <= 100; i++) Q.arr[i] = 0;

	Q.first = 0;
	Q.last = 0;
}

void bfs(int s){
    int i, j, u, v;

    for(i = 0; i < 101; i++){
        color[i] = 0;
        d[i] = -1;
    }

    color[s] = 1;
    d[s] = 0;
    
	enq(s);
	
	while(Q.first != Q.last){
		u = deq();
		for(v = 1; v <= nm; v++){
			if(R[u][v] == 1 && color[v] == 0){
				color[v] = 1;
				d[v] = d[u] + 1;
				enq(v);
			}
			color[u] = 2;
		}
	}

}

int main(){
    int i, j, snm, nnm, lnm;

	init_queue(Q);

    for(i = 0; i < 101; i++){
        for(j = 0; j < 101; j++){
            R[i][j] = 0;
        }
    }

    scanf("%d", &nm);

    for(i = 0; i < nm; i++){
        scanf("%d%d", &nnm, &snm);
        for(j = 0; j < snm; j++){
                scanf("%d", &lnm);
                R[nnm][lnm] = 1;
        }
    }

	bfs(1);

	for(i = 1; i <= nm; i++){
		printf("%d %d\n", i, d[i]);
	}

    return 0;
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N,C;
  cin >> N >> C;
  int D[C][C];
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      cin >> D[i][j];
    }
  }
  int c[N][N];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> c[i][j];
      c[i][j]--;
    }
  }
  int cost[C][3];
  for (int i = 0; i < C; i++) {
    cost[i][0] = 0;
    cost[i][1] = 0;
    cost[i][2] = 0;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      int md = (i+j) % 3;
      for (int k = 0; k < C; k++) {
        cost[k][md] += D[c[i][j]][k];
      }
    }
  }

  int ans = 999999999;
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      for (int k = 0; k < C; k++) {
        if (i == j || j == k || k == i) {
          continue;
        }
        ans = min(ans,cost[i][0] + cost[j][1] + cost[k][2]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1280
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    int a = kbd.nextInt();
	    int b = kbd.nextInt();
	    solve(a, b);
	}
    }

    static void solve(int a, int b){
	int ans = Math.min(a, b);
	while(!(a%ans==0 && b%ans==0)) ans--;
	System.out.println(ans);
    }
}

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

int main(void)
{
	int a,b,length;
	char Ans[8];
	while(scanf("%d %d",&a,&b)!=EOF){
		sprintf(Ans,"%d",a+b);
		length=strlen(Ans);
		printf("%d\n",length);
	}
	return 0;
}

Measured memory_bytes: 612
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll mypow(ll a, ll b) {
  ll ans = 1;
  ll tmp;
  ll two;
  while(b>0) {
    two = 1;
    tmp = a;
    while(2*two<b) {
      tmp *= tmp;
      tmp %= mod;
      two *= 2;
    }
    b -= two;
    ans *= tmp;
    ans %= mod;
  }
  return ans;
}

int main() {
  int N;
  cin>>N;
  cout<<(mypow(10, N)-2*mypow(9, N)%mod+mod+mypow(8, N))%mod<<endl;
}



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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	int S = (N&1) ? N : N + 1;
	
	if (N&1) {
		print((N-1) * (N-2)/2 - (N-1) / 2 + (N - 1));
	} else {
		print(N * (N - 1) / 2 - N / 2);
	}
	for (int i = 1; i < S; ++i) {
		for (int j = i + 1; j < S; ++j) {
			if (i + j != S) print(i, j); 
		}
	}
	if (N&1) {
		for (int i = 1; i < N; ++i) print(i, N);
	}
}

Measured memory_bytes: 256
#include "stdio.h"
#define __int64  long long

__int64 a[11] = {3,8,2,7,1,6,0,5,10,4,9};
int main()
{
    __int64 n,k,sum,i;
    while (scanf ("%lld%lld",&n,&k) != EOF)
    {
        n = 7*n-16;
        sum = n/11 - n/77*2;
        if (a[k] <= n%11)
        {
            sum++;
        }
        for (i=a[k];i<=n%77;i+=11)
        {
            if (i%7 == 6 || i%7 == 0)
            {
                sum--;
            }
        }
        printf ("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 256
import random
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(D)]
t = [0] * D
for i in range(D):
    r=((i+1)%26)+1
    t[i] = r
 
    
M=22*10*2
day=[random.randint(1,365) for i in range(M)]
q=[random.randint(1,26) for i in range(M)]
    
m=[0]*D
 
a=[[0 for i in range(26)] for j in range(D)]
for u in range(D):
    i=t[u]
    for y in range(u,D):
        a[y][i-1]=u+1
    if u==0:
        m[u]=s[u][i-1]
    else:
        m[u]=m[u-1]+s[u][i-1]
mm=[0]*D
for d  in range(D):
    for i in range(26):
        mm[d]+=c[i]*(d+1-a[d][i])
    if not d==0:
        mm[d]+=mm[d-1]
for d in range(D):
    m[d]-=mm[d]
mmm=m[D-1]
 
 
 
for p in range(M):
    new_type=q[p]
    old_type=t[day[p]-1]
    #print(new_type,old_type)
    A=0
    B=0
    C=0
    #C=s[day[p]-1][old_type-1]-s[day[p]-1][new_type-1]
    for d in range(D):
        A+=c[new_type-1]*(d+1-a[d][new_type-1])+c[old_type-1]*(d+1-a[d][old_type-1])
    xday=day[p]
    if xday>1:
        before_new=a[xday-2][new_type-1]
        before_old=a[xday-2][old_type-1]
        now_new=a[day[p]-1][new_type-1]
        now_old=a[day[p]-1][old_type-1]
        for d in range(day[p]-1,D):
            if a[d][new_type-1]==now_new:
                a[d][new_type-1]=xday
            if a[d][old_type-1]==now_old:
                a[d][old_type-1]=before_old
    else:
        for d in range(day[p]-1,D):
            if a[d][old_type-1]==1:
                a[d][old_type-1]=0
            if a[d][new_type-1]==0:
                a[d][new_type-1]=1   
    t[day[p]-1]=new_type
    for d in range(D):
        B+=c[new_type-1]*(d+1-a[d][new_type-1])+c[old_type-1]*(d+1-a[d][old_type-1])
    s=mmm-(B-A+C)
    if s>mmm:
        mmm=s
    #print(mmm)
for i in range(len(t)):
    print(t[i])

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

 
int main(){
  ll N;
  cin >> N;
  ll C[5];
  rep(i, 5){
    cin >> C[i];
  }
  ll s =min({C[0], C[1] , C[2] , C[3] , C[4]});
  ll ans = ((N + s - 1) / s) + 4;
  cout << ans << endl;
 }

Measured memory_bytes: 256
/*     *******************Bismillahir Rahmanir Rahim************************
                          MD. ASFAKUL GHANI!
                          *ProMAGFAT*!
 SECRET_warning :)->FAT   CSE-25!
                          JAHANGIRNAGAR UNIVERSITY!
                          Dhaka,Bangladesh!
*/

#include <bits/stdc++.h>
using namespace std;

#define           fasterIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define           Im int main()
#define           ll long long
#define           sc scanf
#define           pf printf
#define           rn0 return 0
#define           rn return
#define           f0(i,n) for(ll i=0;i<n;i++)
#define           f1(i,n) for(ll i=1;i<=n;i++)
#define           f2(i,n) for(ll i=n-1;i>=0;i--)
#define           pi 2*acos(0.0)
#define           modulo 1000003
#define           dd double
#define           PI 3.14159265358979
#define           pi 2*acos(0.0)
#define           p_b push_back
#define           ps push

/*
ll for_binarySearch(ll a,ll b,ll aa[],ll x){while(a<=b){ll mid=(a+b)/2;if(aa[mid]==x) return 1;else if(aa[mid] > x) b=mid-1;else a=mid+1;}return -1;}
ll for_gcd(ll a,ll b){if(a==0) return b;else return for_gcd(b%a,a);}
ll for_prime(ll x){for (ll i=2;i*i<=x;i++){if(x%i==0) return 0;}return 1;}
void for_swap(char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
ll for_big_mod(ll b,ll p,ll m){if(p==0) return 1;else if(p%2==0){ll k=for_big_mod(b,p/2,m);return (k*k)%m;}else return ((b%m)*(for_big_mod(b,p-1,m)))%m;}
ll for_josephus(ll n,ll k){if(n==1) return 1;return (for_josephus(n-1,k)+k-1)%n+1;}
ll for_gcdExtended(ll a,ll b,ll *x,ll *y){if(a==0){*x=0;*y=1;return b;}ll x1,y1;ll gcd=for_gcdExtended(b%a,a,&x1,&y1);*x=y1-(b/a)*x1;*y=x1;return gcd;}
*/
/*
void debug1()
{
    cout << "***" << endl;
}

void debug11(ll n)
{
    cout << n << endl;
}
*/
#define MAX 100010
ll prime[MAX],c;
bool vis[MAX+2];
void FAT_pf()
{
    vis[0] = vis[1] = 1;
    for (ll i = 4; i < MAX; i += 2) vis[i] = 1;
    prime[c++] = 2;
    for (ll i = 3; i < MAX; i += 2){
        if (!vis[i]){
            prime[c++] = i;
            for (ll j = (i*i); j < MAX; j += (i+i)) vis[j] = 1;
        }
    }
}

Im
{
    /*#ifdef FAT
       freopen("input.txt","w",stdin);
    #endif // FAT*/

    fasterIO;

    FAT_pf();
    ll n;
    cin>>n;
    ll a1[101010];
    ll f = 0;
    ll p = n;
    for (ll i = 0; prime[i]*prime[i] <= p; i += 1){
        while (n%prime[i]==0){
            a1[f++] = prime[i];
            n /= prime[i];
        }
    }

    if (n>1) a1[f++] = n;

    cout << p << ":";
    for (ll i = 0; i < f; i += 1) cout << " " << a1[i];
    cout << endl;


    //main();

    rn0;
}

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

int n, m;
bool graph[60][60];
bool visited[60];
void dfs(int x)
{
	if (visited[x]) return;
	visited[x] = true;
	for (int i = 0; i < n; i++)
	{
		if (graph[x][i])
			dfs(i);
	}
}
signed main(void)
{
	int ans;
	cin >> n >> m;
	int a[m], b[m];

	rep(i, m)
	{
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		graph[a[i]][b[i]] = true;
		graph[b[i]][a[i]] = true;
	}
	ans = 0;
	rep(i, m)
	{
		bool connected = true;
		rep(i, n) visited[i] = false;
		graph[a[i]][b[i]] = false;
		graph[b[i]][a[i]] = false;
		dfs(0);
		rep(i, n)
		{
			if (!visited[i])
				connected = false;
		}
		if (!connected)
			ans++;
		graph[a[i]][b[i]] = true;
		graph[b[i]][a[i]] = true;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>                                                                                                                                                 
#include <vector>
#include <algorithm>
using namespace std;
 
int n;
vector<int> et[100000];
int dist[100000];
int parent[100000];
 
int dfs(int v, int p, int c) {
        parent[v] = p;
    dist[v] = 1;
        for (int i = 0; i < et[v].size(); i++) {
                if (et[v][i] == p) continue;
        dist[v] += dfs(et[v][i], v, c+1);
        }
    return dist[v];
}
 
void reverse(vector<int> &a) {
        int l = 0, r = a.size() - 1;
        while (l < r) {
                swap(a[l], a[r]);
                l++;
                r--;
        }
}
 
int getCut() {
        vector<int> path;
        int v = n - 1;
 
        while (true) {
                path.push_back(v);
                v = parent[v];
                if (v == 0) break;
        }
        path.push_back(v);
 
        reverse(path);
 
        int length = path.size() - 1;
        return path[length / 2 + 1];
}
 
int main() {
        int i;
 
        cin >> n;
        for (i = 0; i < n - 1; i++) {
                int a, b;
                cin >> a >> b;
                a--;
                b--;
                et[a].push_back(b);
                et[b].push_back(a);
        }
        dfs(0, -1, 0);
        // for (i = 0; i < n - 1; i++) {
    //     cout << i << ": " << dist[i];
    //     cout << ", parent" << ": " << parent[i] << endl;
    // }
        int v = getCut();
    int len = dist[v];
 
    int get_node_num = 0;
        // for (i = 0; i < n - 1; i++) {
    //     cout << i << ": " << dist[i] << endl;
    //     // if(dist[i] < len)
    //     //     ++get_node_num;
    // }
 
        // if (get_node_num + et[v].size() <= n - get_node_num) { cout << "Snuke" << endl; }
        if (dist[v] >= n - dist[v]) { cout << "Snuke" << endl; }
        else { cout << "Fennec" << endl; }
        return 0;
}

Measured memory_bytes: 14972
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string << endl
#define all(s) (s).begin(), (s).end()

int main() {
    int d, g;
    cin >> d >> g;
    vector<vector<int> > data(d, vector<int>(2));
    rep(i,d) rep(j,2) cin >> data.at(i).at(j);
    int c=1;
    rep(i,d) c *= 2;
    int count=0, ans=1000;
    rep(i,c) {
        int score=0;
        count = 0;
        rep(j,d) {
            if (i & (1<<j)) {
                score += 100*(j+1)*data.at(j).at(0) + data.at(j).at(1);
                count += data.at(j).at(0);
            }
        }
        if (score < g) {
            int cou=0, minmin=1000;
            rep(j,d) {
                if (!(i & (1<<j))) {
                    cou = (g-score+(j+1)*100-1)/((j+1)*100);
                    //while (score+100*cou < g) cou++;
                    if (cou <= data.at(j).at(0)) minmin = min(minmin, cou);
                }
            }
            count += minmin;
        }
        ans = min(ans, count);
    }
    ct(ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
long k = 1e9+7;
char dot = '.', wall = '#';
int h, w;
void dfs(int x, int y, char **board, int **dp, bool **visited) {
	if(board[x][y] == wall || x >=h || y>=w || visited[x][y]) {
		return;
	}
	visited[x][y] = true;
	if(x+1 < h) {
		dfs(x+1, y , board, dp, visited);
		dp[x][y]+=dp[x+1][y]%k;
	}

	if(y+1 < w) {
		dfs(x, y+1, board, dp, visited);
		dp[x][y]+=dp[x][y+1]%k;

	}
}

int main() {
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error", "w", stderr);*/
	cin>>h>>w;
	char **board;
	int **dp;
	bool **visited;
	board = new char*[h]; 
	dp = new int*[h];
	visited = new bool*[h];
	for(int i=0; i<h; i++) {
		board[i] = new char[w];
		dp[i] = new int[w];
		visited[i] = new bool[w];
	}	

	for(int i=0; i<h; i++) {
		for(int j=0; j<w; j++) {
			cin>>board[i][j];
			dp[i][j] = 0;
			visited[i][j] = false;
		}
	}

	dp[h-1][w-1] = 1;

	dfs(0, 0, board, dp,visited);
	cout<<dp[0][0]%k;

}	

Measured memory_bytes: 9704
# 
import queue

H,W=map(int,input().split())
c,b=[],0
for i in [0]*H:
    c.append(input())
    b+=c[-1].count('#')
    
vis=[[0]*W for _ in [0]*H]

q=queue.Queue()
q.put((0,0,1))
res=-1
while not q.empty():
    x,y,d=q.get()
    for dx,dy in [(1,0),(0,1),(-1,0),(0,-1)]:
        nx,ny=x+dx,y+dy
        if (nx,ny)==(W-1,H-1):
            res=H*W-(d+1)-b
        if 0<=nx<=W-1 and 0<=ny<=H-1:
            if not vis[ny][nx] and c[ny][nx]=='.':
                q.put((nx,ny,d+1))
                vis[ny][nx]=1
        if res>-1:
            break
    if res>-1:
        break
print(res)

Measured memory_bytes: 9732
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int oo = 1e9 + 7;
const ll mod = 1e9 + 7;
const double PI = acos(-1);


int main (){
    cout << fixed << setprecision(20);
    int n, m;
    ll sum = 0, aux;
    cin >> n >> m;

    priority_queue<int> fila;

    for (int i=0; i<n; i++){
        cin >> aux;
        fila.push(aux);
        sum += aux;
    }

    while (!fila.empty() and m){
        ll tmp = fila.top();
        fila.pop();

        sum -= (tmp/2 + (tmp&1));
        if (tmp/2) fila.push(tmp/2);
        m--;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  char s[4];cin>>s[0];
  string res="Good";
  for(int i=1; i<4; i++){
    cin>>s[i];
    if(s[i-1]==s[i]){
      res = "Bad";
      break;
    }
  }
  cout<<res<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    void solve(){
        ios::sync_with_stdio(false);
        string s;
        cin>>s;
        int n=s.size();
        int ans=n;
        for(int u=1;u<n;u++){
            if(s[u]!=s[u-1])ans=min(ans,max(u,n-u));
        }
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 512
void main() {
	auto S = rs;
	auto N = S.length;
	auto arr = new int[](N);
	arr[0] = 1;
	foreach(i; 0..N-1) arr[i+1] = (10*arr[i]) % 2019;
	debug arr.writeln;
	int[int] m;
	int tmp = S[$-1] - '0';
	m[tmp]++;
	foreach(i; 0..N) {
		tmp = tmp + arr[i] * (S[$-i-1] - '0');
		debug tmp.writeln;
		tmp %= 2019;
		m[tmp]++;
	}
	ulong res;
	debug m.writeln;
	foreach(v; m.values) res += v * (v-1) / 2;
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 3968
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iterator>
#include <algorithm>
#include <map>
#include <string.h>
#include <vector>
#include <cmath>
#include <deque>
#include <iomanip>

using namespace std;
#define range(a) a.begin(), a.end()
#define rep(i, c) for(int i = 0; i < (int)c; i++)
typedef long long ll;

template <typename T> ostream& operator<<(ostream& out, vector<T> &v){
  for (int i = 0; i < (int)v.size(); i++) {
    out<<v[i]<<' ';
  }
  return out;
}

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

  int s, w;
  cin >> s >> w;
  if(w >= s) cout << "unsafe";
  else cout << "safe";





  return 0;
}


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

int main() {
  int n,age,a[7] = {};
  while(cin >> n) {
    if(n == 0) break;
    int a[7] = {};
    for(int i=0;i<n;i++) {
      cin >> age;
      age/=10;
      if(age <= 5) {
      a[age]++;
      }
      else {
        a[6]++;
      }
    }

    for(int i=0;i<7;i++) {
      cout << a[i] << endl;
    }
  }
}

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	int a,b,c;
	cin >> a >> b >> c;
	int ans = 0;
	ans = 100*a + 10*b + c;
	if(ans %4 )
		cout << "NO\n";
	else cout << "YES\n";	
	return 0;
}

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

class Program
{
	static void Main(string[] args)
	{
		// 文字列の入力
		var S = Console.ReadLine();
		var targetList = new List<string>() { "dream", "dreamer", "erase", "eraser" };
		var hitFlag = false;

		// 逆さから読むとかぶらない・・・
		S = string.Join("", S.Reverse());
		targetList = targetList.Select(x => string.Join("", x.Reverse())).ToList();
		var flag = true;
		for (int i = 0; i < S.Length;)
		{
			var flag2 = false;
			foreach (var x in targetList)
				if (S.Length - i < x.Length) continue;
				else if (S.Substring(i, x.Length) == x) { flag2 = true; i += x.Length; }
			if (!flag2) { flag = false; break; }
		}
		if (flag) Console.WriteLine("YES");
		else Console.WriteLine("NO");

	}

}

Measured memory_bytes: 16480
import kotlin.math.PI

fun main() {
    val (n,m) = readIntList()
    val a = readIntList()

    if (n - a.sum() >= 0) {
        println(n - a.sum())
    } else {
        println(-1)
    }
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}


Measured memory_bytes: 39260
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

vector<int> g[606];
double dp[606];
double ans;
int main() {
  int n,m;
  cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int s,t;
    cin >> s >> t;
    --s; --t;
    g[s].push_back(t);
  }

  for(int i = n - 2; i >= 0; i--) {
    double p = 1 / (double) g[i].size();
    double tmp = 0;
    for(int j = 0; j < g[i].size(); j++) {
      tmp += p * dp[g[i][j]];
    }
    dp[i] = tmp + 1;
  }

  ans = dp[0];
  
  for(int i = 0; i < n; i++) {
    vector<double> dp2(n,0);
  
    for(int j = n - 2; j >= 0; j--) {
      int nn = g[j].size();
      double tt = 0;
      double ma = 0;
      for(int k = 0; k < g[j].size(); k++) {
	tt += dp2[g[j][k]];
	ma = max(ma,dp2[g[j][k]]);
      }
      if(i == j && nn >= 2) {
	nn--;
	tt -= ma;
      }
      dp2[j] = tt / nn + 1;
    }
    if((i == 0 && g[i].size() == 1) || dp2[0] == 1) continue;
    ans = min(ans,dp2[0]);
  }

  cout << setprecision(10) << ans << endl;
}


Measured memory_bytes: 1536
/*
Author : N_o_o_B
Created : December 03 2019 00:57:41 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    int n,l;
    cin >> n >> l;
    vi a(n);
    fori(i,n) cin >> a[i];
    fori(i,n-1){
        if(a[i]+a[i+1] >= l){
            cout << "Possible" << endl;
            rep(j,1,i){
                cout << j << endl;
            }
            repd(j,n-1,i+2){
                cout << j << endl;
            }
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << "Impossible" << endl;
    time_taken();
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
     
    using namespace std;
     int vec[3],vec2[3];
     
    int main(){
        bool flag = true;
        int n,m ,s ,c;

        cin >> n >> m;

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

            if(n > 1 && s == 1 && c == 0){
                flag = false;
                continue;
            }
            else if(c != vec[n-s] && vec[n-s]> 0){
                flag = false;
                continue;
            }
            vec[n-s] = c;
            vec2[n-s]++;
            

        }
        
        if(flag){
        
        if(vec[2] == 0 && vec[1] == 0 && n == 3)
            cout<< 100+vec[0]<< "\n";
        
        else if(vec[2] == 0 && n == 3)
            cout<< 100 + vec[1]*10 + vec[0]<< "\n";
        else if(vec[1] == 0 && n == 2)
            cout<< 10+vec[0]<< "\n";
        else if( n == 1)
            cout<< vec[0]<< "\n";
        
        else{
            cout<< 100*vec[2] + 10*vec[1] +vec[0] << "\n";
        }
            }
        else{
            cout<< "-1"<< "\n";
        }

       return 0;
    }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int money = 100;
		for (int i = 0; i < n; i++) {
			money = (int) Math.ceil(money * 1.05);
		}
		System.out.println(money * 1000);
	}
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    ll X;
    cin >> X;

    ll n500 = X / 500;
    ll n5 = (X - n500 * 500) / 5;

    cout << n500 * 1000 + n5 * 5 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define arep(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;

const int INF = 1 << 30;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> D(N), cnt(13, 0);
    rep(i, 0, N) {
        cin >> D[i];
        cnt[D[i]]++;
    }
    cnt[0]++;
    rep(i, 0, 13) {
        if ((i == 0 || i == 12) && cnt[i] >= 2) {
            cout << 0 << endl;
            return 0;
        }
        if (cnt[i] >= 3) {
            cout << 0 << endl;
            return 0;
        }
    }
    int ans = 0;
    rep(mask, 0, 1 << 11) {
        vector<bool> is_exist(24, false);
        is_exist[0] = true;
        rep(i, 0, 12) {
            if (cnt[i + 1] == 0) continue;
            else if (cnt[i + 1] == 1) {
                if (mask & (1 << i)) is_exist[i + 1] = true;
                else is_exist[23 - i] = true;
            }
            else {
                is_exist[i + 1] = is_exist[23 - i] = true;
            }
        }
        int now_ans = INF;
        rep(i, 0, 24) rep(j, i + 1, 24) {
            if (is_exist[i] && is_exist[j]) {
                now_ans = min(now_ans, min(abs(i - j), 24 - abs(i - j)));
            }
        }
        if (now_ans == INF) continue;
        ans = max(ans, now_ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Edge {
    ll to;     // 辺の行き先
    ll weight; // 辺の重み
    Edge(ll t, ll w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;

int main() {

    // 頂点数と辺数
    ll n; cin >> n;
    ll m = n - 1;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(n);
    for (ll i = 0; i < m; ++i) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        G[a].push_back(Edge(b, c));
        G[b].push_back(Edge(a, c));
    }
    ll q, k; cin >> q >> k;
    k--;

    // BFS のためのデータ構造
    vector<ll> dist(n, -1); // 全頂点を「未訪問」に初期化
    queue<Edge> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[k] = 0;
    que.push(Edge(k,0)); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        Edge v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (Edge new_v : G[v.to]) {
            if (dist[new_v.to] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 new_v について距離情報を更新してキューに追加する
            dist[new_v.to] = dist[v.to] + new_v.weight;
            que.push(new_v);
        }
    }
    ll ans = 9223372036854775807LL;
    for (ll i = 0; i < q; i++) {
        ll x, y; cin >> x >> y;
        x--;
        y--;
        cout << dist[x] + dist[y] << endl;       
    }
	return 0;
}

Measured memory_bytes: 12756
my $a = <STDIN>;
chomp $a;
my $b = <STDIN>;
chomp $b;
my @list = split(" ", $b);

my $max = $list[0];
# 一番長い辺を探す
foreach my $c (@list) {
	if ($c > $max) {
		$max = $c;
	}
}

my $sum = 0;
my $d = 0;
# max以外の合計を計算する
foreach my $c (@list) {
	if ($d eq 0 and $c == $max) {
		$d = 1;
		next;
	}
	$sum += $c;
}

#print $max, "\n";
#print $sum, "\n";

if ($max < $sum) {
	print "Yes\n";
}
else {
	print "No\n";
}
exit 0;


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long int64;
char s[15];
int main() {
	scanf("%s",s + 1);
	int l = strlen(s + 1);
	for(int i = 1 ; i < l ; ++i) {
		if(s[i] == 'A' && s[i + 1] == 'C') {
			puts("Yes");return 0;
		}
	}
	puts("No");return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
template <typename T> using
Treap = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#define endl "\n"
#define all(V) V.begin( ), V.end( )
#define Unique(V) sort( all( V ) ), V.erase( unique( all( V ) ), V.end() )
std::mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)
#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template < typename Arg1 >
void __f( const char* name , Arg1&& arg1 ) { cerr <<name<<" : "<<arg1<< "\n"; }
template < typename Arg1 , typename... Args >
void __f( const char* names , Arg1&& arg1 , Args&&... args ) {
const char* comma = strchr( names + 1 , ',' );
cerr.write( names , comma - names ) <<" : "<<arg1<<" , "; __f( comma+1 , args...);}

typedef long long int LL;
typedef pair <int,int> pii;
typedef pair <long long,long long> pll;
const int MOD = 1e9 + 7;
const double EPS = 1e-8;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;

string s;
int dp[ N ][ 2 ];

int solve( int idx , int prev ) {
        if( idx >= s.size() ) return 0;
        if( dp[idx][prev] != -1 ) return dp[idx][prev];
        int ret = inf;
        int cur = s[idx]-'0';
        if( cur == prev ) ret = min( ret , 1 + solve( idx + 1 , !cur ) );
        else ret = min( ret , solve( idx + 1 , cur ) );
        return dp[idx][prev] = ret;
}
int main( int argc , char const *argv[] ) {
        ios_base::sync_with_stdio( false ); cin.tie( nullptr );
        #ifdef forthright48
            freopen( "input.txt" , "r" , stdin );
        #endif // forthright48
        cin >> s;
        memset( dp , -1, sizeof( dp ) );
        int ans = min( solve( 1 , s[0]-'0' ) , solve( 1 , !( s[0]-'0' ) ) + 1);
        cout << ans << endl;
        return 0;
}











Measured memory_bytes: 7504
// AOJ 2664: Shopping
// 2017.12.3 bal4u@uu

#include <stdio.h>
#include <string.h>

#define HASHSIZ 10007
typedef struct { char *s; int id, w; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash + HASHSIZ;			// Hash table

void insert(char *s, int w, int id)
{
	HASH *tp = hash + (101 * *s + 103 * *(s+w-1) + 107 * w) % HASHSIZ;
	while (tp->s != NULL) {
		if (tp->w == w && memcmp(tp->s, s, w) == 0) return;
		if (++tp == hashend) tp = hash;
	}
	tp->s = s, tp->id = id, tp->w = w;
}

int lookup(char *s, int w)
{
	HASH *tp = hash + (101 * *s + 103 * *(s+w-1) + 107 * w) % HASHSIZ;
	while (tp->s != NULL) {
		if (tp->w == w && memcmp(tp->s, s, w) == 0) break;
		if (++tp == hashend) tp = hash;
	}
	return tp->id;
}

#define MAX 5002
/* UNION-FIND library */
int p[MAX], rank[MAX];

void make_set(int x) { p[x] = x, rank[x] = 0; }
void link(int x, int y) {
	if (rank[x] > rank[y]) p[y] = x;
	else { p[x] = y; if (rank[x] == rank[y]) rank[y] = rank[y] + 1;	}
}
int find_set(int x) { if (x != p[x]) p[x] = find_set(p[x]);	return p[x]; }
void union_set(int x, int y) { link(find_set(x), find_set(y)); }

int x[MAX];
char s[MAX][12];

char buf[30], *bp;
int getint()
{
	int n = 0;
	while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
	return n;
}

int main()
{
	int n, m, i, j, ans;
	char *q;

	fgets(bp=buf, 10, stdin), n = getint();
	for (i = 0; i < n; i++) p[i] = i;

	for (i = 0; i < n; i++) {
		fgets(bp=buf, 20, stdin);
		q = bp; while (*bp >= 'a') bp++;
		*bp = 0, memcpy(s[i], q, bp-q), insert(s[i], bp-q, i);
		bp++, x[i] = getint();
	}

	fgets(bp=buf, 10, stdin), m = getint();
	while (m--) {
		fgets(bp=buf, 30, stdin);
		q = bp; while (*bp >= 'a') bp++;
		*bp = 0, i = lookup(q, bp-q);

		q = ++bp; while (*bp >= 'a') bp++;
		*bp = 0, j = lookup(q, bp-q);
		union_set(i, j);
	}

//	for (i = 0; i < n; i++) find_set(i);
	for (i = 0; i < n; i++) {
		j = find_set(i);
		if (x[i] < x[j]) x[j] = x[i];
	}

	ans = 0;
	for (i = 0; i < n; i++) ans += x[p[i]];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2064
s = str(input())
y = int(s.split("/")[0])
m = int(s.split("/")[1])
d  = int(s.split("/")[2])

if y<=2018:
    print("Heisei")
elif y>=2020:
    print("TBD")
else:
    if m<=4:
        print("Heisei")
    else:
        print("TBD")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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 (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  string str;
  cin >> str;
  bool h=true;
  int c = 0;
  if(str[0]!='A') h=false;
  if(str[1]<'a' || str[1] > 'z') h=false;
  iFOR(i,2,str.length()-1){
    if(str[i]=='C') c++;
    else if(str[i]<'a' || str[i] > 'z') h=false;
  }
  if(c!=1) h=false;
  if(str[str.length()-1]<'a' || str[str.length()-1] > 'z') h=false;
  if(h) cout <<"AC\n";
  else cout <<"WA\n";
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const ll inf=1e18+10;

ll x;

int main(){
	cin>>x;
	ll org=100.0;
	for(int i=0;;i++){
		org=org+org/100;
	// 	cout<<org<<endl;
		if(org>=ldb(x)){
			cout<<i+1<<endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3604