akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
    char S[10];
    int i;
    int x=0;
    int ans=0;
    int total=0;

    scanf("%s",&S);

    while(x<10){
        switch(S[x]){
            case 'A':
                ans+=1;
                break;
            case 'T':
                ans+=1;
                break;
            case 'C':
                ans+=1;
                break;
            case 'G':
                ans+=1;
                break;
            default:
                if(total<ans)
                    total=ans;
                ans=0;
                break;
        }
        if(total<ans)
            total=ans;
        x++;
    }
    printf("%d",total);


    return 0;
}


Measured memory_bytes: 128
// Problem : D - Wizard in Maze
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

bool check(int x,int n)
{
	return x>=0 and x<n;
}
void solve()
{
	int n,m;cin>>n>>m;
	int stx,sty,enx,eny;
	cin>>stx>>sty>>enx>>eny;
	vs v(n);cin>>v;
	deque<pii> q;
	int vis[n][m];
	for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	vis[i][j]=INT_MAX/2;
	vis[stx-1][sty-1]=0;
	q.push_front({stx-1,sty-1});
	while(!q.empty())
	{
		pii p=q.front();
		q.pop_front();
		for(int i=0;i<4;i++)
		{
			int x=p.f+dx1[i];
			int y=p.se+dy1[i];
			if(check(x,n) and check(y,m) and vis[p.f][p.se]<vis[x][y] and v[x][y]!='#')
			{
				vis[x][y]=vis[p.f][p.se];
				q.push_front({x,y});
			}
		}
		for(int i=-2;i<=2;i++)
		{
			for(int j=-2;j<=2;j++)
			{
				int x=p.f+i;
				int y=p.se+j;
				if(check(x,n) and check(y,m) and vis[p.f][p.se]+1<vis[x][y] and v[x][y]!='#')
				{
				vis[x][y]=vis[p.f][p.se]+1;
				q.push_back({x,y});
				}
			}
		}
	}
	if(vis[enx-1][eny-1]==INT_MAX/2)
	cout<<-1;
	else
	cout<<vis[enx-1][eny-1];
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 12648
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
using namespace std;
const int maxn=100005;
int n,ans;
struct qujian
{
	int l,r;
	bool operator < (const qujian &a) const
	{
		return r<a.r;
	}
}q[maxn];
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
		if(ch=='-')
			f=-1;
		ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
    }
    return x*f;
}
inline void write(int a)
{
    if(a<0)
    {
		putchar('-');
		putchar('1');
    }
    else
    {
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
    }
}

int main()
{
    n=read();
	for(int i=1;i<=n;++i)
	{
		int x=read(),l=read();
		q[i].l=x-l,q[i].r=x+l;
	}
	sort(q+1,q+n+1);
	int pos=-1e9;
	for(int i=1;i<=n;++i)
		if(q[i].l>=pos)
			++ans,pos=q[i].r;
	write(ans);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long idx=0;
    string S;
    cin >> S;
    long Q;
    cin >> Q;
    long T, F;
    char C;
    long reverse_count = 0;
    //string head, tail;
    deque<char> ans;
    for(int i = 0; i < S.size(); i ++)
    {
        char c = S[i];
        ans.push_back(c);
    }
    for(size_t i=0;i<Q;i++)
    {
        cin >> T;

        if(T == 1) reverse_count++;
        else
        {
            //cerr << "反転" << reverse_count << endl;
            cin >> F >> C;
            //反転状態の場合は逆になる
            if(reverse_count % 2 == 0)
            {
                if(F == 1) ans.push_front(C);//head= C + head;
                else ans.push_back(C);//tail+=C;
            }else
            {
                if(F == 1) ans.push_back(C);//head=C + head;
                else ans.push_front(C);//tail+=C;
            }
        }
        //cerr << S << endl;
    }
    //S = head + S + tail;
    if(reverse_count % 2 == 0)
    {
        for(auto itr = ans.begin(); itr != ans.end(); ++itr) {
            cout << *itr;
        }
        cout << endl;
    }else
    {
        //cerr << "最後に反転" << endl;
        //reverse(ans.begin(), ans.end());
        for(auto itr = ans.rbegin(); itr != ans.rend(); ++itr) {
            cout << *itr;
        }
        cout << endl;
    }
    //cout << ans << endl;
    return 0;
}

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

using namespace std;

int c[555][555], n, d[33][33];
inline int f(int i, int k) {
	int r = 0;
	for (int x = 0; x < n; x++)
		for (int y = 0; y < n; y++)
			if ((x + y) % 3 == i)
				r += d[c[x][y]][k];
	return r;
}
int main()
{
	int C;
	cin >> n >> C;
	for (int i = 1; i <= C; i++)
		for (int j = 1; j <= C; j++)
			cin >> d[i][j];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			scanf("%d", c[i] + j);
	pair<int, int> w[3][33];
	for (int i = 0; i < 3; i++) {
		for (int j = 1; j <= C; j++)
			w[i][j] = make_pair(f(i, j), j);
		sort(w[i] + 1, w[i] + C + 1);
	}
	int m = 1e9;
	for (int i = 1; i < 4; i++) {
		for (int j = 1; j < 4; j++) {
			if (w[0][i].second == w[1][j].second)
				continue;
			for (int k = 1; k < 4; k++) {
				if (w[0][i].second == w[2][k].second || w[1][j].second == w[2][k].second)
					continue;
				m = min(m, w[0][i].first + w[1][j].first + w[2][k].first);
			}
		}
	}
	cout << m << endl;
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
   string  a,b;
   cin>>a>>b;
    ll res=0;
    for(ll i=0;i<a.size();i++)
    {
    	if(a[i]!=b[i])
    	 res++;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3916
n=gets.to_i
1.upto(3500) do |a|
  a.upto(3500) do |b|
    if 4*a*b-n*(a+b)!=0
      if (n*a*b) % (4*a*b-n*(a+b))==0
        c=(n*a*b)/(4*a*b-n*(a+b))
        if c>0
          puts [a,b,c].join(" ")
          exit
        end
      end
    end
  end
end


Measured memory_bytes: 14376
#include<bits/stdc++.h>
#define PI 3.1415926535
#define N 10010
using namespace std;
int n, m;
int a, b, c;
int d[N];
int x ,y, w, h, r;
int p = 1;
int cnt = 0;
int main(){
    while (scanf("%d %d", &n, &m), n||m){
        for(int i = 0 ; i < n; i++){
            for(int j = 0; j < m; j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3140
def resolve():
    import math
    K = int(input())
    K += 1
    ans = 0
    for i in range(1, K):
        for j in range(1, K):
            ij = math.gcd(i, j)
            for k in range(1, K):
                ans += math.gcd(ij, k)
    print(ans)
resolve()

Measured memory_bytes: 67772
from collections import Counter
N=int(input())
A=list(map(int, input().split()))
C=Counter(A)
L=[]
R=[]
for i in C:
  l=C.get(i)
  if l>=2:
    L.append(i)
    if l>=4:
      R.append(i)
L.sort()
R.sort()

ans=0

if len(L)>=2:
  ans=max(L[-1]*L[-2], ans)
if len(R)>=1:
  ans=max(R[-1]**2, ans)
print(ans)


Measured memory_bytes: 101008
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>
#include <sstream>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

int main(){
    ll N;
    cin >> N;

    ll min=INF,kaisu=sqrt(N)+1,wa,rs;

    for(int i = 1;i <= kaisu;i++){
        if(N % i == 0){
            rs = N / i;
            wa = rs + i -2;
            if(min > wa)
                min = wa;
        }
    }

    cout << wa << endl;

} 

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    int x[3][110];
    scanf("%d",&n);
    for(int i=1;i<=2;i++)
        for(int j=1;j<=n;j++)
            scanf("%d",&x[i][j]);
    for(int i=2;i<=n;i++)
        x[1][i]+=x[1][i-1];
      for(int i=n-1;i>=1;i--)
        x[2][i]+=x[2][i+1];
    int ans=0;
      for(int i=1;i<=n;i++)
        ans=max(ans,x[1][i]+x[2][i]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
using namespace std;

const int INF = 1e6;

int n, m;
struct edge { int d, w; };
vector<edge> g[110];
int W[10010];

int dfs(int u, int l, int r, int *vis) {
    int res = 1;
    vis[u] = true;
    for (int i = 0; i < (int)g[u].size(); ++i) {
        edge &e = g[u][i];
        if (!vis[e.d] && l <= e.w && e.w <= r) {
            res += dfs(e.d, l, r, vis);
        }
    }
    return res;
}

bool check(int l, int r) {
    int vis[110];
    memset(vis, 0, sizeof vis);
    return dfs(0, l, r, vis) == n;
}

int main() {
    srand(958270938);
    while (cin >> n && n) {
        cin >> m;
        for (int i = 0; i < n; i++) {
            g[i].clear();
        }
        for (int i = 0; i < m; i++) {
            int a, b, w;
            cin >> a >> b >> w;
            --a; --b;
            g[a].push_back({ b,w });
            g[b].push_back({ a,w });
            W[i] = w;
        }

        sort(W, W + m);
        const int k = unique(W, W + m) - W;
        random_shuffle(W, W + k);

        int ans = INF;
        if (check(0, INF)) {
            for (int i = 0; i < k; ++i) {
                if (!check(W[i], W[i] + ans - 1)) continue;
                int lo = W[i] - 1;
                int hi = INF;
                while (lo + 1 < hi) {
                    int mid = (lo + hi) / 2;
                    if (check(W[i], mid)) {
                        hi = mid;
                    } else {
                        lo = mid;
                    }
                }
                ans = min(ans, hi - W[i]);
            }
        }
        if (ans == INF) ans = -1;
        cout << ans << '\n';
    }
}

Measured memory_bytes: 3276
#include <stdio.h>
#define DATANUM 100

int arraymax(int va[], int n);

int main(void) {
    int data[DATANUM] = {0};
    int num, i = 0;
    
    while(scanf("%d", &num) != EOF) {
        
        if(i++ == 100) break;
        
        data[num]++;
        
    }
    
    for(i = 0; i < DATANUM; i++) {
        if(data[i] == arraymax(data, DATANUM))
            printf("%d\n", i);
    }
   
    return(0);
}

int arraymax(int va[], int n) {
    int max, i;
    
    max = va[0];
    
    for(i = 1; i < n; i++) {
        if(va[i] > max)
            max = va[i];
    }
    
    return(max);
}

Measured memory_bytes: 596
S = input()
T = input()
x = len(S)-len(T)+1
y = len(T)
list = [0] * (x)
for i in range(x):
  X = S[i:i+y]
  for j in range(y):
    if X[j] != T[j]:
      list[i] += 1
list = sorted(list)
print(list[0])
    

Measured memory_bytes: 8972
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int n,s;
  while(cin>>n>>s,n||s){
    vector<int> r(n);
    REP(i,n)cin>>r[i];
    sort(r.begin(), r.end());
    int ans = 0;
    REP(i,n){
      int t = s - r[i];
      vector<int>::iterator it = upper_bound(r.begin(), r.end(), t);
      ans += min(n-i-1, (int)distance(it, r.end()));
    }
    cout<<ans<<endl;
  }
      


  return 0;
}

Measured memory_bytes: 944
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 3000000000000000000;

int main() {
    int N;
    cin >> N;
    int ans = 0;
    rep(i, N) {
        int a;
        cin >> a;
        if (a & 1) ans = 1;
    }
    cout << (ans ? "first\n" : "second\n");
    return 0;
}


Measured memory_bytes: 3560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s[] = br.readLine().split(" ");
		int a = Integer.parseInt(s[0]);
		int b = Integer.parseInt(s[1]);
		int c = Integer.parseInt(s[2]);
		int count = 0;
		for (int i = a; i <= b; i++) {
			if (c % i == 0)
				count += 1;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 24444
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    print(a[0]*a[1]//2)  
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 38512
N,K=map(int, input().split())
a_ls=list(map(int, input().split()))


for i in range(K+1,N+1):
	if a_ls[i-1]>a_ls[i-K-1]:
		print("Yes")
	else:
		print("No")


# 2darray [[0] * 4 for i in range(3)]

Measured memory_bytes: 31432
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int di[] = {-1, 0, 1, 0};
int dj[] = {0, -1, 0, 1};

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    int ans = 0;

    rep(si, h) rep(sj, w)
    {
        if (s[si][sj] == '#')
            continue;
        vvi dist(h, vi(w, INF));
        queue<P> q;
        auto update = [&](int i, int j, int x) {
            if (dist[i][j] != INF)
                return;
            dist[i][j] = x;
            q.push(P(i, j));
        };

        update(si, sj, 0);

        while (!q.empty())
        {
            int i = q.front().fi;
            int j = q.front().se;
            q.pop();

            rep(dir, 4)
            {
                int ni = i + di[dir];
                int nj = j + dj[dir];
                if (ni < 0 || ni >= h || nj < 0 || nj >= w)
                    continue;
                if (s[ni][nj] == '#')
                    continue;
                update(ni, nj, dist[i][j] + 1);
            }
        }

        rep(i, h)
        {
            rep(j, w)
            {
                if (dist[i][j] == INF)
                    continue;
                ans = max(ans, dist[i][j]);
            }
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll n,x;cin>>n>>x;
  ll ans=0;
  cin>>ans;
  ans=abs(ans-x);
  while(--n){
    ll a;cin>>a;
    ans=gcd(ans,abs(a-x));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



int main() {
    int h, a;
    int ans = 0;
    cin >> h >> a;
    while (h > 0) {
        h -= a;
        ans++;
    } 
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# ABC 108: B – Ruined Square
x1, y1, x2, y2 = [int(s) for s in input().split()]

print('{} {} {} {}'.format(x2 - (y2 - y1), y2 + (x2 - x1), x1 - (y2 - y1), y1 + (x2 - x1)))

Measured memory_bytes: 2940
//knapsack, fide min weigat in each value
#include<iostream>
#include<vector>
using namespace std;

int main() {
    int n, weight_limit;
    cin >> n >> weight_limit;
    vector<vector<int>> vec(n, vector<int>(2)); //vec.at(count) = {weight, value}
    int value_range = 0;
    for ( int i = 0; i < n; ++i) {
        cin >> vec.at(i).at(0) >> vec.at(i).at(1);
        value_range += vec.at(i).at(1);
    }

    vector<vector<int>> DP(2, vector<int>(value_range, weight_limit+1));
    for ( int count = 0; count < n; ++count) {
        for ( int value = 1; value <= value_range; ++value) {
            if ( value <= vec.at(count).at(1)) {
                DP.at(1).at(value-1) = min( DP.at(0).at(value-1), vec.at(count).at(0));
            }
            else {
                DP.at(1).at(value-1) = min( DP.at(0).at(value-1 - vec.at(count).at(1)) + vec.at(count).at(0), DP.at(0).at(value-1));
            }
        }
        for ( int i = 0; i < value_range; ++i) { //slide DP.at(1) -> DP.at(0)
            DP.at(0).at(i) = DP.at(1).at(i);
        }
    }

    int ans;
    for (int i = 0; i < value_range; ++i){
        if (DP.at(1).at(value_range-1 - i) <= weight_limit){
            ans = value_range - i;
            break;
        }
    }
    cout << ans << endl; //answer
}

Measured memory_bytes: 1408
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, P: "List[int]"):

    count = 0
    m = INF
    for p in P:
        if m > p:
            count += 1
            m = p
    print(count)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)


if __name__ == '__main__':
    main()


Measured memory_bytes: 25680
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M, c;
  cin>>N>>M>>c;
  vector <int> vec1(M);
  for(int i=0; i<M; i++){
    cin>>vec1.at(i);
  }
  vector <vector<int>> vec2(N,vector <int>(M,0));
  for(int i=0; i<N; i++){
    for(int j=0; j<M; j++){
      cin>>vec2.at(i).at(j);
    }
  }
  int ans=0;
  int sum=0;
  for(int i=0; i<N; i++){
    sum=0;
    for(int j=0; j<M; j++){
      sum+=vec1.at(j)*vec2.at(i).at(j);    
    }
    if(sum+c>0){
      ans++;
    }
  }
  cout<<ans<<endl;
}
      


Measured memory_bytes: 3620
#include <iostream>
#define MAX_N 1001
#define MAX 1000000007
using namespace std;

bool isPrime[MAX_N];

void judgePrime() {
  isPrime[0] = isPrime[1] = false;
  for (int i = 2; i < MAX_N; i++) {
    for (int j = i + i; j < MAX_N; j += i) {
      isPrime[j] = false;
    }
  }
}

void init() {
  for (int i = 0; i < MAX_N; i++) {
    isPrime[i] = true;
  }
}

int main() {
  init();
  judgePrime();

  long long n;
  cin >> n;

  long long ans = 1;
  for (int i = 2; i <= n; i++) {
    if (isPrime[i] == false) continue;
    int t = 0;
    for (int j = i; j <= n; j += i) {
      int tj = j;
      while (tj % i == 0) {
	t++;
	tj /= i;
      }
    }
    ans *= t + 1;
    if (ans > MAX) ans %= MAX;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,N) for(int i=0;i<N;i++)
#define MOD 1000000007

using namespace std;

int main(void){
    int A;
    string s;
    cin>>A>>s;
    if(A>=3200)cout<<s<<endl;
    else cout<<"red"<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner;
     
    public class Main {
     
    	public static void main(String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int N = sc.nextInt();
    		int M = sc.nextInt();
     
    		int L = 0;
    		int R = N;
     
    		for (int i=0; i<M; i++) {
    			int L2 = sc.nextInt();
    			int R2 = sc.nextInt();
     
    			L = Math.max(L, L2);
    			R = Math.min(R, R2);
    		}
     
    		int ans = R-L+1;
    		if (ans>0) System.out.println(ans);
    		else System.out.println(0);
    	}
    }

Measured memory_bytes: 60304
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
int main() {
    int N;
    cin>>N;
    vector<bool> a(N);
    for (int i = 0; i < N; i++){
        int x;cin>>x;
        a[i]=x;
    }
    vector<bool> ans(N);
    int M=0;
    for(int i=N; i>0; i--){
        int sum=0;
        int j=i+i;
        while(j<=N){
            sum+=(int)ans[j-1];
            j+=i;
        }
        if((sum%2==0)==(!a[i-1]))ans[i-1]=0;
        else {
            ans[i-1]=1;
            M++;
        }
    }
    cout<<M<<endl;
    for (int i = 0; i < N; i++)if(ans[i])cout<<i+1<<endl;
}

Measured memory_bytes: 3668
import java.util.Scanner;

/**
 * AtCoder Beginner Contest 158
 * D - String Formation
 * https://atcoder.jp/contests/abc158/tasks/abc158_d
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        StringBuilder sbB = new StringBuilder();
        StringBuilder sbE = new StringBuilder();
        int q = sc.nextInt();

        boolean isAsc = true;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            if (t == 1) {
                isAsc = !isAsc;
            } else {
                int f = sc.nextInt();
                if (f == 1) {
                    if (isAsc) {
                        sbB.append(sc.next());
                    } else {
                        sbE.append(sc.next());
                    }
                } else {
                    if (isAsc) {
                        sbE.append(sc.next());
                    } else {
                        sbB.append(sc.next());
                    }
                }
            }
        }
        if (isAsc) {
            System.out.print(sbB.reverse().toString());
            System.out.print(sb.toString());
            System.out.print(sbE.toString());
        } else {
            System.out.print(sbE.reverse().toString());
            System.out.print(sb.reverse().toString());
            System.out.print(sbB.toString());
        }

    }
}


Measured memory_bytes: 130248
from collections import deque
n=int(input())
data=set()
ans=deque()
for i in range(n):
    command=input().split()
    if command[0]=="insert":
        data.add(command[1])
    else:
        ans.append("yneos"[1-(command[1] in data)::2])


for i in range(len(ans)):
    print(ans.popleft())



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

int main(void){
	char s[1001];
	int i = 0;
	scanf("%[^\n]%*c" , s);
	while(s[i] != '\0'){
		if(s[i] == 'a'){
			if(s[i+1] == 'p'
				&& s[i+2] == 'p'
				&& s[i+3] == 'l'
				&& s[i+4] == 'e'){
				printf("peach");
				i += 5;
			}else{
				printf("%c" , s[i]);
				i++;
			}
		}else if(s[i] == 'p'){
			if(s[i+1] == 'e'
				&& s[i+2] == 'a'
				&& s[i+3] == 'c'
				&& s[i+4] == 'h'){
				printf("apple");
				i += 5;
			}else{
				printf("%c" , s[i]);
				i++;
			}
		}else{
			printf("%c" , s[i]);
			i++;		
		}
	}
	printf("\n");

	return 0;
}

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


int main() {
    while(true){
        int D,E;
        cout<<setprecision(16);
        cin >> D>>E;
        if(D == 0 || E==0) return 0;
        double minc=1e7;
        for(int i=0;i<=D/2;i++){
            double x=i;
            double y=D-i;
            double cos=sqrt(x*x+y*y)-E;
         cos=abs(cos);
            minc=min(minc,cos);

        }
        cout<<minc<<endl;
    }
    return 0;
}


Measured memory_bytes: 3172
import java.util.*;
 
public class Main {
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] l = new int[n];
      int sum = 0;
      for (int i = 0; i < n; i++) {
        l[i] = sc.nextInt();
        sum+=l[i];
      }
      Arrays.sort(l);
      int max = l[l.length - 1];
      sum -= max;
      if (max < sum) {
        System.out.println("Yes");
        System.exit(0);
      }
      System.out.println("No");
    }
  }

Measured memory_bytes: 23124
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long ans = 0;
		for(int i = 0; i < N; i++) 
			ans += sc.nextInt() - 1;
		System.out.println(ans);
		
	}

}

Measured memory_bytes: 26964
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
int main()
{
	ll N; cin >> N;
	ll sum = 0;
	rep(i, 0, N) {
		ll l, r; cin >> l >> r;
		sum += r - l + 1;
	}

	cout << sum << endl;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]

march='MARCH'
h = []
for x in s:
  if x[0] in march:
    h.append(x[0])

d = {}
for c in march:
  d[c]=0

for x in h:
  d[x] += 1

ans=0
import itertools
for com in itertools.combinations(d.values(), r=3):
  pro=1
  for x in com:
    pro *= x
  ans+=pro

print(ans)


Measured memory_bytes: 10648
' Imports System.Collections.Generic
Imports System.Text
' Imports System.Text.RegularExpressions

Class Main
    Public Shared Sub Main()
        Dim N As Integer = Console.ReadLine()
        Dim S As String = Console.ReadLine()
        Dim alp As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        Console.WriteLine(Trans(S, alp, alp.Substring(N) + alp.Substring(0, N)))
        Return
    End Sub

    Shared Function Trans(ByVal S As String, ByVal f As String, ByVal t As String) As String
        Dim sb As New StringBuilder(S.Length)
        For i As Integer = 0 To S.Length - 1
            Dim idx = f.indexOf(S(i))
            sb.Append(t(idx))
        Next
        Trans = sb.ToString()
    End Function
End Class


Measured memory_bytes: 28368
let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

()
|> readIntArray
|> fun [| _; x |] ->
    ()
    |> readIntArray
    |> Array.mapFold (fun s a -> (s, s + a)) 0
    |> fun (a, b) -> Array.concat [ a; [| b |] ]
    |> Array.filter ((>=) x)
    |> Array.length
    |> printfn "%d"


Measured memory_bytes: 30736
#include <iostream>
#include <cmath>

using namespace std;

const int MAX_N = 10;
const int MAX_D = 10;

int x[MAX_N][MAX_D + 1];

int n, d;

int distSquare(int i, int j)
{
    int res = 0;

    for (int k = 0; k < d; ++k)
    {
        res += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
    }

    return res;
}

bool isSquareInt(int t)
{
    int init = int(sqrt(t));
    if (init * init == t)
    {
        return true;
    }
    init++;
    if (init * init == t)
    {
        return true;
    }
    return false;
}

int main()
{
    cin >> n >> d;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < d; ++j)
        {
            cin >> x[i][j];
        }
    }

    int res = 0;

    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            if (isSquareInt(distSquare(i, j)))
            {
                res++;
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
    
public class Main {
  public static void main(String[] args){

	  Scanner sc = new Scanner(System.in);
	  int W = sc.nextInt();
	  int H = sc.nextInt();
	  int x = sc.nextInt();
	  int y = sc.nextInt();
	  int r = sc.nextInt();
	  if(x<r||y<r){
		  System.out.println("No");
	  }else if(x+r>W || y+r>H){
		  System.out.println("No");
	  }else{
		  System.out.println("Yes");
	  }
  }
}

Measured memory_bytes: 26236
N = int(input())

red = [tuple(map(int, input().split())) for _ in range(N)]
blue = [tuple(map(int, input().split())) for _ in range(N)]

red = sorted(red, key=lambda x: x[1], reverse=True)
blue = sorted(blue, key=lambda x: x[0])

ans = 0
for b in blue:
    for r in red:
        if r[0] < b[0] and r[1] < b[1]:
            ans += 1
            red.remove(r)
            break

print(ans)


Measured memory_bytes: 3064
use std::io::{self, BufReader, Read};
use std::str::FromStr;
use std::string::String;

fn main() {
	let mut sc = ::Scanner::new(io::stdin());
	let n: i32 = sc.next_as().unwrap();
	let k: i32 = sc.next_as().unwrap();
	println!("{}", if n % k == 0 { 0 } else { 1 });
}

#[derive(Debug)]
pub struct Scanner<R> {
	reader: BufReader<R>
}

impl<R: io::Read> Scanner<R> {
	
	pub fn new(read: R) -> Scanner<R> {
		Scanner { reader: BufReader::new(read) }
	}

	pub fn next_str(&mut self) -> Option<String> {
		let mut buf = [0; 1];
		let size = self.reader.read(&mut buf).unwrap();
		if size == 0 {
			None{}
		} else {
			let first = self.skip_whitespace(&mut buf);
			if first.is_none() {
				return None{}
			}
			let mut v = vec![buf[0]];
			loop {
				let size = self.reader.read(&mut buf).unwrap();
				if size == 0 || char::from(buf[0]).is_whitespace() {
					break;
				}
				v.push(buf[0]);
			}
			Some(String::from_utf8(v).unwrap())
		}
	}

	pub fn next_line(&mut self) -> Option<String> {
		let mut buf = [0; 1];
		let mut v :Vec<u8> = vec![];
		let mut size = self.reader.read(&mut buf).unwrap();
		if size == 0 {
			return None{}
		}
		loop {
			if size == 0 || char::from(buf[0]) == '\n' {
				return Some(String::from_utf8(v).unwrap())
			}
			v.push(buf[0]);
			size = self.reader.read(&mut buf).unwrap();
		}
	}

	pub fn next_vec<S: FromStr>(&mut self, size: u32) -> Vec<S> {
		let mut v: Vec<S> = vec![];
		for _ in 0..size {
			let token = self.next_str().unwrap();
			v.push(S::from_str(&token).ok().unwrap());
		}
		v
	}

	pub fn next_as<S: FromStr>(&mut self) -> Option<S> {
		if let Some(s) = self.next_str() {
			if let Ok(v) = S::from_str(&s) {
				return Some(v)
			}
		}
		None{}
	}

	pub fn next_i32(&mut self) -> Option<i32> {
		self.next_as::<i32>()
	}

	pub fn next_i64(&mut self) -> Option<i64> {
		self.next_as::<i64>()
	}

	pub fn next_f32(&mut self) -> Option<f32> {
		self.next_as::<f32>()
	}

	pub fn next_f64(&mut self) -> Option<f64> {
		self.next_as::<f64>()
	}

	fn skip_whitespace(&mut self, mut buf: &mut [u8]) -> Option<u8> {
		loop {
			if !char::from(buf[0]).is_whitespace() {
				return Some(buf[0])
			}
			let size = self.reader.read(&mut buf).unwrap();
			if size == 0 {
				return None{}
			}
		}
	}
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define LL long int
#define MOD (LL)pow(10,9) + 7


int main(){
    LL a,b;
    cin >> a >> b;
    for(int i = 1; i <= 1010 ; ++i){
        if(floor(i * 0.08) == a && floor(i * 0.1) == b){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef unsigned long long ull;
typedef vector<ull> vec;
typedef vector<vec> mat;
typedef pair<int,ull> P;
#define N 4
ull po[N*N+10];
ull m2i(mat m){
  int res=0;
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      res+=m[i][j]*po[i*N+j];
  return res;
}
mat i2m(ull x){
  mat res(N,vec(N));
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      if(i==N-1&&j==N-1) res[i][j]=x/po[i*N+j];
      else res[i][j]=(x%po[i*N+j+1])/po[i*N+j];
  return res;
}
int dist(mat m){
  int res=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(!m[i][j]) continue;
      int k=m[i][j]-1;
      int y=k/N,x=k%N;
      res+=abs(i-y)+abs(j-x);
    }
  }
  return res;
}
signed main(){
  po[0]=1;
  for(int i=0;i<N*N;i++) po[i+1]=po[i]*(N*N);
  mat p(N,vec(N));
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      cin>>p[i][j];
  mat e(p);
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      e[i][j]=i*N+j+1;
  e[N-1][N-1]=0;
  ull ans=m2i(e);
  priority_queue<P,vector<P>,greater<P> > q;
  map<ull,int> m;
  q.push(P(dist(p),m2i(p)));
  m[m2i(p)]=0;
  int ax[]={1,0,-1,0};
  int ay[]={0,1,0,-1};
  while(!q.empty()){
    P y=q.top();q.pop();
    ull x=y.second;
    if(x==ans) break;
    p=i2m(x);
    int zy,zx;
    for(int i=0;i<N;i++)for(int j=0;j<N;j++)if(p[i][j]==0)zy=i,zx=j;
    for(int k=0;k<4;k++){
      int ny=zy+ay[k],nx=zx+ax[k];
      if(ny<0||N<=ny||nx<0||N<=nx) continue;
      swap(p[zy][zx],p[ny][nx]);
      ull t=m2i(p);
      if(!m.count(t)||m[x]+1<m[t]){
        m[t]=m[x]+1;
        q.push(P(m[t]+dist(p),t));
      }
      swap(p[zy][zx],p[ny][nx]);
    }
  }
  cout<<m[ans]<<endl;
  return 0;
}



Measured memory_bytes: 177620
#include <stdio.h>
const int N = 305;
const int M = 305;
int main ()
{
	int n, m;
	while(scanf("%d %d", &n, &m))
	{
		if(n == 0 && m == 0)
		{
			break;
		}
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < m; j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
	
}


Measured memory_bytes: 2624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 200000
#define mod1 1000000007
#define mod2 1000000009
#define mod3 998244353
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
vector <ll> vis(N+5,0),in_deg(N+5,0),out_deg(N+5,0),depth(N+5,0);
vector <ll> G[N+5];
void dfs(ll node)
{
	for(auto child:G[node])
	{
		if(depth[child]==0)
		{
			dfs(child);
			depth[node] = max(depth[node],1 + depth[child]);
		}
		else
			depth[node] = max(depth[node],1+depth[child]);
	}
	return;
}
int main()
{
    IO
	clock_t begin = clock();
    ll n,m;
    cin>>n>>m;
    for(ll i=1;i<=m;i++)
    {
    	ll p,q;
    	cin>>p>>q;
    	G[p].push_back(q);
    	in_deg[q]++;
    	out_deg[p]++;
    }
    ll ma = 0;
    for(ll i=1;i<=n;i++)
    {
    	if(!in_deg[i])
    	{
    		dfs(i);
    		ma = max(ma,depth[i]);
    	}
    }
    cout<<ma<<endl;
    // cout<<double(clock() - begin)/CLOCKS_PER_SEC<<endl;
    return 0;
}

Measured memory_bytes: 21888
#include <iostream>
#include <algorithm>
#include <cmath>
#include <functional>
using namespace std;

int main() {
	while(1){
		int n, m;
		cin >> n;
		cin >> m;
		if(n == 0 && m == 0)break;
		int a[10000], b[10000];
		for(int i = 0; i < m; i++)
			cin >> a[i] >> b[i];
		
		int friends[10001] = {0};
		for(int i = 0; i < m; i++){
			if(a[i] == 1)
				friends[b[i]] = 1;
		}
		int fof[10001] = {0};
		for(int i = 0; i < m; i++){
			if(friends[a[i]] == 1 && friends[b[i]] == 0 && fof[b[i]] == 0)
				fof[b[i]] = 1;
			if(friends[b[i]] == 1 && friends[a[i]] == 0 && fof[a[i]] == 0 && a[i] != 1)
				fof[a[i]] = 1;
		}
	
		int ans = 0;
		for(int i = 1; i <= n; i++){
			ans += friends[i];
			ans += fof[i];
		}
		cout << ans << endl;
	}
	
	return 0;
}

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

public class Main {
  public static void main(String[] args) {
	Scanner scn = new Scanner(System.in);
	int n =scn.nextInt();
	int[]dp = new int[3];
	Arrays.fill(dp, 0);
	for(int day=0;day<n;day++)
	{
		int[]cost = new int[3];
		for(int i=0;i<3;i++)
		{
			cost[i]=scn.nextInt();
		}
		int[]newdp = new int[3];
		Arrays.fill(newdp, 0);
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				if(i!=j)
				newdp[j]=Math.max(newdp[j], dp[i]+cost[j]);
			}
		}
		dp=newdp;
	}
	System.out.println(Math.max(dp[0], Math.max(dp[1], dp[2])));
}
}


Measured memory_bytes: 59372
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;

int main(void) {
	long long int n, sum;
	long long int l;
	int m;
	map<int,long long int> a;
	queue <long long int> b;
	int i;
	cin >> n;
	sum = 0;
	for (i = 0; i < n; i++) {
		cin >> m;
		b.push(m);
		a[m]++;
	}
	for (auto s : a) {
		sum += (s.second * (s.second - 1)) / 2;
	}
	for (i = 0; i < n; i++) {
		l = a[b.front()];
		l--;
		cout << sum - l << endl;
		b.pop();
	}

	return 0;
}

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

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


	bool b = false;
	for (int i = 1; i <= A * B; i++) {
		int n = A * i;
		if (n % B == C) {
			b = true;
			break;
		}
	}

	cout << (b ? "YES" : "NO") << endl;
}

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


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

    int i = 0;

    while(i < 100000)
    {
        if(floor(i*0.08) == A && floor(i*0.1) == B)
        {
            cout << i << endl;
            return 0;
        }
        else
        {
            i++;
        }   
    }

    cout << -1 << endl;


    return 0;
}

Measured memory_bytes: 256
s = list(input())

while 1:
    if len(s)==0:
        print("YES")
        exit()
    if 1<len(s)<4:
        print("NO")
        exit()
    if len(s)>=5:
        if "".join(s[-5:]) == "dream" or "".join(s[-5:]) == "erase":
            del s[-5:]
        elif "".join(s[-6:]) == "eraser":
            del s[-6:]
        elif "".join(s[-7:]) == "dreamer":
            del s[-7:]
        else:
            print("NO")
            exit()


Measured memory_bytes: 49904
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String vertex = sc.nextLine();
        Integer N = Integer.parseInt(vertex);
        String lineList = sc.nextLine();
        String lines[] = lineList.split(" ");

        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int index=0; index<lines.length; index++) {
            list.add(Integer.parseInt(lines[index]));
        }

        Integer[] numbers = list.toArray(new Integer[list.size()]);
        Arrays.sort(numbers, Collections.reverseOrder());

        Integer largestLine = numbers[0];
        int lineSum = 0;
        for(int i = 0; i<numbers.length; i++) {
            lineSum += numbers[i];
        }
        if (largestLine < (lineSum - largestLine)) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}

Measured memory_bytes: 24404
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll prev;
    ll ans = 0;
    imfor(i, n) {
        ll x;
        cin >> x;
        if (i == 0) {
            prev = x;
        }
        else {
            ans += min((x - prev) * a, b);
            prev = x;    
        }
    }
    cout << ans << endl;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int a, b, c;
	cin >> a >> b >> c;

	if(c >= a && c <= b){
		puts("Yes");
	}else{
		puts("No");
	}
	
	return 0;
}


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

int main() {
  int N, M, num;
  cin >> N >> M;

  vector<int> city(N);
  
  for (int i = 0; i < M; i++)
  {
	cin >> num;
    city[num-1]++;
	cin >> num;
    city[num-1]++;
  }
 
  for (int i = 0; i < N; i++)
  {
    cout << city[i] << endl;
  }

}


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

int main() {
  int A, B;
  cin >> A >> B;
  int64_t low, high, answer;
  if (A > B){
    high = A;
    low = B;
  } else {
    high = B;
    low = A;
  }
  
  for(int i=1; i<=high; i++){
    if((i*low)%high != 0){
      continue;
    } else {
      answer = i*low;
      break;
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxx = 2000000;

int A[maxx + 1];
int n;
void maxHeapify(int i) {
	
	int left = 2 * i, right = 2 * i + 1;
	int largest;

	// ?????????????????????????????????????????????????????§??????????????¶?????§???????????????
	if (left <= n && A[left] > A[i])
		largest = left;
	else
		largest = i;

	if (right <= n && A[right] > A[largest])
		largest = right;
	
	if (largest != i) {
		swap(A[i], A[largest]);
		maxHeapify(largest);
	}

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

	for (int i = n / 2; i >= 1; i--)
		maxHeapify(i);
	for (int i = 1; i <= n; i++)
		printf(" %d", A[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 5068
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    sort(l.begin(),l.end());
    int ans=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            int temp=l[i]+l[j];
            auto ret=lower_bound(l.begin(),l.end(),temp);
            ans+=ret-(l.begin()+j)-1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))

int N, M, P;

int main()
{
    while (cin >> N >> M >> P)
    {
        if (N == 0 && M == 0 && P == 0)
            return 0;
        int sum = 0, people = 0;
        vector<int> a(N);
        for (int i = 0; i < N; i++)
        {
            cin >> a[i];
            sum += a[i] * 100;
            people += a[i];
        }
        if (a[M - 1] == 0)
        {
            cout << 0 << "\n";
        }
        else
        {
            sum -= sum * P / 100;
            cout << sum / a[M - 1] << "\n";
        }
    }
}


Measured memory_bytes: 3008
#include <stdio.h> 
int n;       
int main()
{
	scanf("%d",&n);
	if(n>=64&&n<=100)
		printf("64");
	else if(n>=32)
		printf("32");
	else if(n>=16)
		printf("16");
	else if(n>=8)
		printf("8");
	else if(n>=4)
		printf("4");
	else if(n>=2)
		printf("2");
	else
		printf("1");
	return 0;
}

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

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; }

const long long INF = 1LL << 60;

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

  ll ans = (x/11) * 2;
  if(x%11 > 0) ans++;
  if(x%11 > 6) ans++;

  cout << ans << endl;

  return 0;
}


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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
		cin.tie(0);							     \
		cout.tie(0);
#define sz(arr) (ll)arr.size()

using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }

//vector<pair<ll,ll>> factors(ll n) {
//	vector<pair<ll,ll>> f;
//	for (ll x = 2; x * x <= n; ++x) {
//		ll cnt = 0;
//		while (n % x == 0) {
//			++cnt;
//			n /= x;
//		}
//		if (cnt > 0)
//			f.push_back({ x, cnt });
//	}
//	if (n > 1) f.push_back({ n,1 });
//	return f;
//}

//ll f[200005];
//ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }

ll dp[2009][2009];

int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
	fastio;
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	if (n == 1) {
		cout << 0;
		return 0;
	}
	sort(a.begin(), a.end());
	int ans = 1e9 + 9;
	for (int med = 0; med <= 100; ++med) {
		int res = 0;
		for (int i = 0; i < n; ++i) {
			res += (a[i] - med) * (a[i] - med);
		}
		ans = min(ans, res);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256