akhauriyash/Code-Regression huggingface dataset:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


# --------------------------------------------

dp = None


def main():
    N, K = li_input()
    L = li_input()

    L.sort(reverse=True)

    print(sum(L[:K]))


main()


Measured memory_bytes: 4684
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline 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;}

template<typename T>
struct WeightedUnionFind {
    vector<int> par, rank;
    vector<T> diff_weight;

    // SUM_UNITY アベール群の単位元
    WeightedUnionFind(int n  = 1, T SUM_UNITY = 0) : par(n+5), rank(n+5), diff_weight(n+5) {
        for(int i = 0; i < n+5; i++)
            par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

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

    T weight(int x){
        root(x);
        return diff_weight[x];
    }
    
    bool same(int x, int y) {return root(x) == root(y);}

    bool merge(int x, int y, T w) {
        w += weight(x) - weight(y);
        if((x=root(x)) == (y=root(y))) return false;
        if(rank[x] < rank[y]) swap(x, y), w = -w;
        rank[x] += (rank[x] == rank[y]);

        par[y] = x, diff_weight[y] = w;
        return true;
    }

    T diff(int x, int y) {return weight(y) - weight(x);
    }
};
        

signed main() {

    int n, m;
    cin >> n >> m;
    int l, r, d;
    WeightedUnionFind<int> uf(n);

    for(int i = 0; i < m; i++) {
        cin >> l >> r >> d;

        if(uf.same(l,r)) {
            if(uf.diff(l,r) != d) {
                cout << "No\n";
                return 0;
            }
        }
        else {
            uf.merge(l, r, d);
        }
    }

    cout << "Yes\n";
    
  
    return 0;
}



Measured memory_bytes: 1408
let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.to_list @@ Array.init n @@ fun _ ->
    Scanf.scanf "%d\n" @@ fun a -> a in
  let bs = Array.to_list @@ Array.init n @@ fun _ ->
    Scanf.scanf "%d\n" @@ fun b -> b in
  List.map (fun a -> (true, a)) as_ @ List.map (fun b -> (false, b)) bs
  |> List.sort (fun (_, a) (_, b) -> compare a b)
  |> List.map fst
  |> List.fold_left (fun (acc, s) b ->
      match s with
      | None -> (acc, Some (b, 1))
      | Some (b', n) ->
          if b = b' then (acc, Some (b', n + 1))
          else (acc * n mod 1000000007, if n = 1 then None else Some (b', n - 1))) (1, None)
  |> fst
  |> Printf.printf "%d\n"


Measured memory_bytes: 33796
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define pii pair<int,int>

using namespace std;

const int mod = 1e9 + 7;
const int nax = 2e5+5;
ll a[nax];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s,t; cin>>s>>t;
    int n = s.length();
    int m = t.length();
    int ans = 1e9;
    for(int i=1;i<=n;i++)
    {
        int lo = i - 1;
        int hi = lo + m - 1;
        if(hi >= n) break;
        int akt = 0;
        for(int j=lo;j<=hi;j++)
        {
            if(s[j] != t[j-lo]) akt++;
        }
        ans = min(ans,akt);
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define re register
#define int long long
using namespace std;
int n,a[100002],b,head[10002],cnt,ans,m,x,k,p[100002],val[5002],mx[5002];
inline int read(){
	re int t=0,f=0;re char v=getchar();
	while(v<'0')f|=(v=='-'),v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return f?-t:t;
}
signed main(){
	n=read();k=read();
	for(re int i=1;i<=n;++i)p[i]=read();
	for(re int i=1;i<=n;++i)a[i]=read();mx[0]=-1e18;
	ans=-1e18;
	for(re int i=1;i<=n;++i){
		re int tot=0,nw=i;
		while(1){
			nw=p[nw];
			++tot;
			val[tot]=val[tot-1]+a[nw];
			mx[tot]=max(mx[tot-1],val[tot]);
			if(nw==i)break;
		}
		if(val[tot]>0)ans=max(ans,(k/tot)*val[tot]+((k%tot==0)?0ll:mx[k%tot]));
		if(k>=tot)ans=max(ans,(k/tot-1)*val[tot]+mx[tot]);
		ans=max(ans,mx[k>=tot?tot:k]);
	}
	printf("%lld",ans);
}


Measured memory_bytes: 3912
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
const int inf = 1012345678;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int a,b,k; cin >> a >> b >> k;
    int mn = min(a,b);
    int ans = 0;
    int tmp = 0;

    for(int i=mn; i>=1; i--){
        if(a%i==0 and b%i==0){
            tmp++;
            if(tmp==k){
                ans = i;
                break;
            }
        }
    }

    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    if (n==1)
        n=14;
    if (m==1)
        m=14;
    if (n>m)
        cout <<"Alice";
    else if (n<m)
        cout <<"Bob";
    else
        cout<<"Draw";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{long long int a,b,c,d,e,s,x,y,z,m;
while(~scanf("%lld%lld%lld%lld",&a,&b,&c,&d))
   { int h(long long int q,long long int p);
   x=b/c-(a-1)/c;
    y=b/d-(a-1)/d;
    e=h(c,d);
    m=c*d/e;
    z=b/m-(a-1)/m;
    s=b-a+1-x-y+z;
    printf("%lld\n",s);
    
   }
}
 int h(long long int q,long long int p)
{if(q%p==0)return(p);
else return (h(p,q%p));
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind, COM//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//
int main() {
	ll A, B, M;
	cin >> A >> B >> M;
	vl a(A);
	vl b(B);
	ll m1 = INF;
	ll m2 = INF;
	for (i = 0; i < A; i++) {
		cin >> a[i];
		m1 = min(m1, a[i]);
	}
	for (i = 0; i < B; i++) {
		cin >> b[i];
		m2 = min(m2, b[i]);
	}
	ans = m1 + m2;
	for (i = 0; i < M; i++) {
		ll x, y, c;
		cin >> x >> y >> c;
		ans = min(ans, a[x - 1] + b[y - 1] - c);
	}
	cout << ans;
}


Measured memory_bytes: 1792
count = Hash.new
ARGF.each do |line|
  line.each_char do |c|
    c = c.downcase
    count[c] = 0 unless count[c]
    count[c] += 1
  end
end
('a'..'z').each do |s|
  if count[s]
    puts "#{s} : #{count[s]}"
  else
    puts "#{s} : 0"
  end
end

Measured memory_bytes: 6088
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const double PI = acos(-1);

ll dp[101][MAX_N] = { 0 };

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll N, W;
	cin >> N >> W;

	vector<ll> w(N), v(N);
	rep(i, N) {
		cin >> w[i] >> v[i];
	}

	rep(i, N) {
		for (int sum_w = 0; sum_w <= W; sum_w++) {
			//i番目の品物を選ぶ場合
			if (sum_w - w[i] >= 0) {
				chmax(dp[i + 1][sum_w], 
					dp[i][sum_w - w[i]] + v[i]);
			}

			//i番目の品物を選ばない場合
			chmax(dp[i + 1][sum_w], dp[i][sum_w]);
		}
	}

	out(dp[N][W]);

	return 0;
}

Measured memory_bytes: 79232
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N, M, C = map(int, readline().split())
B = list(map(int, readline().split()))

ans = 0
for _ in range(N):
    A = map(int, readline().split())
    code_sum = C
    for a, b in zip(A, B):
        code_sum += a*b
    if code_sum > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3064
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int A = sc.nextInt();
    if (X<A){
      System.out.println(0);
    }else{
      System.out.println(10);
    }
  }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
const int MAX=50;
void printString(int n)
{
    char s[MAX];
    int i=0;
    while(n>0)
    {
        int rem=n%26;
        if(rem==0)
        {
            s[i++]='z';
            n=n/26-1;
            
        }
        else
        {
            s[i++]=(rem-1)+'a';
            n/=26;
        }
    }
    s[i]='\0';
    reverse(s,s+strlen(s));
    cout<<s<<endl;
    return;
}
signed main()
{
    c_p_c();
    int n;
    cin>>n;
    printString(n);
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << '\n';

    return 0;
}


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

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout << min(c, a + b + 1) + b << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int x,y,c = 0;
    cin >> x >> y;
    if (abs(x)==abs(y)){
        c = 1;
    }
    else {
        if (x*y==0) {
            if (y>0 or x<0) {
                c = abs(x-y);
            }
            else if (y<0 or x>0) {
                c = abs(x-y);
                c++;
            }
        }
        else if (x<y) {
            if (0<x) {c = y-x;}
            else if (0>x and 0<y) {
                if (abs(x)<y) {
                    ++c;
                    c += y-abs(x);
                }
                else if (abs(x)>y) {
                    c += abs(x)-y;
                    ++c;
                }
            }
            else if (y<0) {c = y-x;}
        }
        else if (y<x) {
            if (0<y) {
                ++c;
                c += abs(x) - y;
                ++c;
            }
            else if (0>y and 0<x) {
                if (abs(y) > x) {
                    ++c;
                    c += abs(y) - x;
                }
                else if (abs(y) < x){
                    c += x - abs(y);
                    ++c;
                }
            }
            else if (x<0) {
                ++c;
                c += x-y;
                ++c;
            }
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

class Item {
	int cost,weight;

	Item(int c,int w) {
		this.cost = c;
		this.weight = w;
	}
}

class Main {
	private static final int NOT_ADD = -1;

	public static void main (String args[]) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String buf;
 
		try {
			long count = 1;
			while (true) {
				int W = Integer.parseInt(br.readLine());
				if (W==0) break;

				int N = Integer.parseInt(br.readLine());
				Item item[] = new Item[N];
				for (int i=0;i<N;i++) {
					StringTokenizer st = new StringTokenizer(br.readLine(),",");
					int c = Integer.parseInt(st.nextToken());
					int w = Integer.parseInt(st.nextToken());
					item[i] = new Item(c,w);
				}
				int T[][] = new int[N][W+1];
				for (int i=0;i<N;i++) {
					for (int j=0;j<=W;j++) T[i][j] = NOT_ADD;
				}
				T[0][0] = 0;
				T[0][item[0].weight] = item[0].cost;
				for (int i=1;i<N;i++) {
					for (int k=0;k<=W;k++) T[i][k] = T[i-1][k];
					for (int k=item[i].weight;k<=W;k++) {
						if (T[i-1][k-item[i].weight]!=NOT_ADD&&T[i-1][k-item[i].weight]+item[i].cost>T[i][k]) {
							T[i][k] = T[i-1][k-item[i].weight]+item[i].cost;
						}
					}
				}
				int MaxCost = T[N-1][0];
				int MaxWeight = 0;
				for (int i=0;i<=W;i++) {
					if (MaxCost<T[N-1][i]) {
						MaxCost = T[N-1][i];
						MaxWeight = i;
					}
				}
				System.out.println("Case "+count+":");
				System.out.println((long)MaxCost);
				System.out.println(MaxWeight);
				count++;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 36160
import sys
from heapq import heappush, heappop


class Dijkstra:

    class Edge:
        def __init__(self, end, cost):
            self.to = end
            self.cost = cost

    def __init__(self, V):
        self._node = V
        self._graph = [[] for i in range(self._node)]
        self.inf = 10 ** 10
        self.dist = [self.inf for i in range(self._node)]

    def add_edge(self, st, ed, cs):
        self._graph[st].append(self.Edge(ed, cs))

    def solve(self, start):
        que = []
        self.dist[start] = 0
        heappush(que, (0, start))
        while que:
            cur_cost, cur_vertex = heappop(que)
            if self.dist[cur_vertex] < cur_cost:
                continue
            for e in self._graph[cur_vertex]:
                if cur_cost + e.cost < self.dist[e.to]:
                    self.dist[e.to] = cur_cost + e.cost
                    heappush(que, (self.dist[e.to], e.to))


if __name__ == '__main__':
    V, E, r = map(int, sys.stdin.readline().split())
    dk = Dijkstra(V)
    for i in range(E):
        s, t, d = map(int, sys.stdin.readline().split())
        dk.add_edge(s, t, d)
    dk.solve(r)
    for value in dk.dist:
        if value == dk.inf:
            sys.stdout.writelines("INF\n")
        else:
            sys.stdout.writelines("%d\n" % value)



Measured memory_bytes: 139904
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define ceil(x, y) (x+y-1)/(y)
int main(){
	ios::sync_with_stdio(0);
	ll l, r;
	cin >> l >> r;
	if(r-l<1000){
		ll ans = 2018;
		for(ll i=l; i<=r; ++i)
			for(ll j=i+1; j<=r; ++j)
				ans = min(ans, (i*j)%2019);
		cout << ans << endl;
	}
	else{
		cout << 0 << endl;
	}
}


Measured memory_bytes: 384
var code = require('fs').readFileSync('/dev/stdin','utf8').trim()

var prePattern = code[0]
var sNum = 0
var bNum = 0
var total = 0

if(code[0] === '>') {
  code = '<' + code
}

for(var i=0;i<code.length;) {
  for(;i<code.length;i++) {
    if(code[i] !== '<') break
      sNum += 1
  }
  for(;i<code.length;i++) {
    if(code[i] !== '>') break
      bNum += 1
  }

  if(sNum > bNum) {
    for(var j=0;j<=sNum;j++) total += j
    for(var j=0;j<bNum;j++) total += j
  } else {
    for(var j=0;j<sNum;j++) total += j
    for(var j=0;j<=bNum;j++) total += j
  }

  sNum = 0
  bNum = 0
}

console.log(total)


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

int main() {
    int a;
    double ans;
    cin >> a;
    ans = (double)((a + 1) / 2) / a;
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())

    r = 0
    minp = a[0]
    for i1 in range(n):
        if minp >= a[i1]:
            r += 1
            minp = a[i1]

    print(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 102948
N, T = map(int, input().split())

cost = [list(map(int, input().split())) for i in range(N)]

ans = []

for c in cost:
  if c[1] < T+1:
    ans.append(c)
    
if ans != []:
  ans = sorted(ans, key=lambda x: x[0])
  print(ans[0][0])
else:
  print("TLE")

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

int main(){
  const double rate= 1.01;
  const int64_t M0= 100;
  int64_t target;
  cin >> target;
  
  int64_t M= M0;
  int64_t ans= 0;
  while(M < target){
    M= (int64_t)(M* rate);
    ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3636
N = int(input())
A = list(map(int,input().split()))
a = abs(A[0]) + abs(A[N-1])
for i in range(N-1):
    a += abs(A[i+1] - A[i])
print(a - (abs(A[0]) + abs(A[1] - A[0])) + abs(A[1])) 
for i in range(1, N-1):
    print(a - (abs(A[i+1] - A[i]) + abs(A[i-1] - A[i])) + abs(A[i+1] - A[i-1]))
print(a - (abs(A[N-1]) + abs(A[N-1] - A[N-2])) + abs(A[N-2]))

Measured memory_bytes: 14176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////




int main(){
    ll h,w;cin>>h>>w;
    string s[h];rep(i,0,h-1)cin>>s[i];
    ll dp[h][w];memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    rep(i,0,h-1){
        rep(j,0,w-1){
            if(s[i][j]=='#')continue;
            if(i-1>=0)Add(&dp[i][j],dp[i-1][j]);
            if(j-1>=0)Add(&dp[i][j],dp[i][j-1]);
        }
    }
    cout<<dp[h-1][w-1]<<endl;
    
    return 0;
}


Measured memory_bytes: 9088
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
ll ketawa(ll a){ll r=0;while(a){r+=a%10;a/=10;}return r;}


int main(){

  ll N;
  cin >> N;

  vector<ll> dp(N+1,MOD);

  dp[0] = 0;
  FOR(i,0,N){
    dp[i+1] = min(dp[i+1],dp[i]+1);
    ll k = 1;
    while(k*6+i <= N){
      dp[k*6+i] = min(dp[k*6+i],dp[i]+1);
      k *= 6;
    }
    k = 1;
    while(k*9+i <= N){
      dp[k*9+i] = min(dp[k*9+i],dp[i]+1);
      k *= 9;
    }
  }
  cout << dp[N] << endl;
}




Measured memory_bytes: 1024
#include<cstdio>
#include<vector>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


class E{
	public:
	int come,to,val;
	bool check;
	E(int come,int to,int val):come(come),to(to),val(val){
		check = false;
	}
};

class Q{
	public:
	int now,val;
	E edge;
	Q(int now,int val,E edge):now(now),val(val),edge(edge.come,edge.to,edge.val){}
	bool operator<(const Q& a)const{
		return val>a.val;
	}
};


const int N = 555;
const int INF = 1000000000;
int n,m;
vector<E> edge[N];
int visit[N];

vector<E> g[N];


bool contain(E ein){
	rep(i,g[ein.come].size()){
		E e = g[ein.come][i];
		if(e.to == ein.to)return true;
	}
	return false;
}

bool saiki(int now,int goal,int cost){
	
	//printf("now %d   goal %d   cost %d\n",now,goal,cost);
	
	if(now==goal){
		return true;
	}
	
	visit[now] = 1;
	
	bool ret = false;
	rep(i,g[now].size()){
		E e = g[now][i];
		if(visit[e.to]==1)continue;
		
		bool res = saiki(e.to, goal,cost);
		if(res==true){
			if(e.val==cost)g[now][i].check=true;
			ret = true;
		}
	}
	
	return ret;
}

void delcheck(E ein){
	//printf("delc  %d %d %d\n",ein.come,ein.to,ein.val);
	
	rep(i,N)visit[i]=0;
	saiki(ein.come, ein.to, ein.val);
	
}

int main(){
	cin>>n>>m;
	
	int mcost = INF;
	
	rep(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		edge[a].push_back(E(a,b,c));
		edge[b].push_back(E(b,a,c));
	}
	
	
	priority_queue<Q> que;
	que.push(Q(1,0,E(-1,-1,-1)));
	
	rep(i,N)visit[i]=0;
	
	vector<E> use;
	
	while(1){
		if(que.empty())break;
		Q u = que.top();
		que.pop();
		
		if(visit[u.now]==1)continue;
		visit[u.now]=1;
		
		use.push_back(u.edge);
		
		rep(i,edge[u.now].size()){
			E e = edge[u.now][i];
			que.push(Q(e.to, e.val, e));
		}
	}
	
	/*
	rep(i,use.size()){
		E e = use[i];
		printf("come%d to%d val%d\n",e.come,e.to,e.val);
		
	}*/
	
	rep(i,use.size()){
		if(use[i].to==-1)continue;
		E e = use[i];
		g[e.come].push_back(E(e.come,e.to,e.val));
		g[e.to].push_back(E(e.to,e.come,e.val));	
	}
	
	
	
	rep(i,N){
		rep(j,edge[i].size()){
			E e = edge[i][j];
			if(!contain(e)){
				delcheck(e);
			}
		}
	}
	
	int cont = 0;
	int sum = 0;
	rep(i,N){
		rep(j,g[i].size()){
			E e = g[i][j];
			//printf("!!! %d %d %d %d\n",e.come,e.to,e.val,e.check);
			if(e.check==false){
				cont++;
				sum+=e.val;
			}
		}
	}
	
	printf("%d %d\n",cont/2,sum/2);
}

/*
4 4
1 2 3
1 3 3
2 3 3
2 4 3

*/

Measured memory_bytes: 7880
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n, l;
  cin >> n;
  l = leng(n);
  vector<int> ok(0);
  int now, nowi, now2, s;
  vector<int> flag(3,0);
  
  rep(i,0,pow(4,l)){
    now = 0;
    nowi = i;
    flag = {0,0,0};
    rep(j,0,l){
      if( (nowi%4)==0 ) now += 0;
      if( (nowi%4)==1 ) now += 3;
      if( (nowi%4)==2 ) now += 5;
      if( (nowi%4)==3 ) now += 7;
      if(j!=l-1) now *= 10;
      nowi /= 4;
    }
    now2 = now;
    
    while(now2!=0){
      s = now2 % 10;
      if( s!=3 && s!=5 && s!=7) {
        flag[0]=0;
        break;
      }
      else if(s==3) flag[0]++;
      else if(s==5) flag[1]++;
      else if(s==7) flag[2]++;
      now2 /= 10;
    }
    if(min({flag[0],flag[1],flag[2]})>=1) ok.pb(now); //cout << now << endl;
  }
  
  int ans = 0;
  rep(i,0,ok.size()){
    if(n >= ok[i]) ans++;
  }
  cout << ans << endl;
}


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

using namespace std;

const int N=1e5;
int n;
int arr[N];
int mem[N];

int solve(int i){
    if(i==n-1)
        return 0;
    if(mem[i]!=-1) return mem[i];
    int op1=solve(i+1)+abs(arr[i]-arr[i+1]);
    int op2=i+2<=n-1?solve(i+2)+abs(arr[i]-arr[i+2]):1000000000;
    return mem[i]=min(op1,op2);
}

int main() {
    scanf("%d",&n);
    for(int i=0;i<n;++i)
        scanf("%d",arr+i);
    memset(mem,-1,sizeof mem);
    printf("%d",solve(0));
    return 0;
}


Measured memory_bytes: 5760
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
    int a,b,x,y,n,m,h,k,max=-10000000,min=1000000000,ans=0,sum=0;
    string s,t;
    cin >> n >> m;
    VI p(n);
    rep(i,n){
        cin >> p[i];
	}

    UnionFind tree(n);

    rep(i,m){
        cin >> x >> y;
        tree.unite(x-1,y-1);
    }

    rep(i,n){
        if(tree.same(i,p[i]-1)){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;

    int days = 0;
    for (size_t i = 0; i < m; i++) {
        int a;
        cin >> a;
        days += a;
    }

    if (days > n) cout << -1 << endl;
    else cout << n - days << endl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;

int main() {
	int n,t;
	cin >> n >> t;
	vector<int> arr(n);
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int max_d = 0;
	{
		int temp_max = arr[n-1];
		for(int i = n-2; i >= 0; i--) {
			max_d = max(max_d,temp_max-arr[i]);
			temp_max = max(temp_max,arr[i]);
		}
	}
	int ans = 0;
	{
		int temp_max = arr[n-1];
		for(int i = n-2; i >= 0; i--) {
			ans += ((temp_max-arr[i])==max_d)?1:0;
			temp_max = max(temp_max,arr[i]);
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int n, cur;
  cin >> n;
  int maxi = -1, ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> cur;
    if (cur >= maxi) ans++;
    maxi = max(maxi, cur);
  }
  cout << ans;
}

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

int main() {
	int n;
	cin>>n;
int nums [100005][3];

	for(int i=0; i<n; i++){
	cin>>nums[i][0]>>nums[i][1]>>nums[i][2];
	}
	vector<int> tem(3,0);
	vector<int> dp(3,0);
	
	for(int i=0; i<n; i++){
		tem=dp;
		tem[0]=nums[i][0]+max(dp[1],dp[2]);
		tem[1]=nums[i][1]+max(dp[0],dp[2]);
		tem[2]=nums[i][2]+max(dp[0],dp[1]);
		dp=tem;
	}
	cout<<max(dp[0],max(dp[1],dp[2]));
	
}

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

int main() {
    int N; cin >> N;
    vector<vector<int>> A(2, vector<int>(N + 1));
    rep(i, 2) rep(j, N) cin >> A[i][j];
    vector<vector<int>> dp(2, vector<int>(N + 1));
    dp[0][0] = A[0][0];
    rep(i, N) {
        dp[1][i] = max(dp[1][i], dp[0][i] + A[1][i]);
        dp[0][i + 1] = max(dp[0][i + 1], dp[0][i] + A[0][i + 1]);
        dp[1][i + 1] = max(dp[1][i + 1], dp[1][i] + A[1][i + 1]);
    }
    cout << dp[1][N - 1] << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
#include <complex>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)


int main(){
    int e,x,y,z;
    int res;

    while( cin >> e, e ){
        res = INT_MAX;
        for(z=0; z*z*z <= e; z++){
            for(y=0; y*y + z*z*z <= e; y++){
                x = e - z*z*z - y*y;
                res = min(res, x + y + z);
            }
        }
        printf("%d\n",res);
    }

    return 0;
}

Measured memory_bytes: 868
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FOR(i,a,b) for(ll i=a; i<= b; ++i)
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define vi vector<int>
#define pb push_back
#define MOD 1000000007
typedef long long ll;

int main(){
    optimize();
    string s;
    cin>>s;
    int n=s.length();
    if(s[n-1]=='s') s+="es";
    else s+= "s";
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
#include <map>
#include <set>
#include <random>
#include <sstream>
#include <stack>
#include <deque>

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

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

int Q;
int bit[101010] = {};
bool used[101010] = {};
bool prime[101010] = {};

void update(int i, int x) {
  while (i < 101010) {
    bit[i] += x;
    i += i & -i;
  }
}

int get(int i) {
  int ret = 0;
  while (i > 0) {
    ret += bit[i];
    i -= i & -i;
  }
  return ret;
}

int main() {
  cin >> Q;
  prime[1] = 0;
  REP(i,2,101010) {
    if (!used[i]) {
      prime[i] = 1;
      for (int j = i; j < 101010; j += i) used[j] = 1;
    }
  }
  REP(i,1,101010) {
    update(i, i > 2 && prime[i] && prime[(i+1)/2]);
  }
  rep(i,Q) {
    int l, r;
    cin >> l >> r;
    cout << get(r) - get(l-1) << endl;
  }
  return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>

int main(void){
  int i;
  int n,s[100];
  int max,maxP,min,minP,sum;

  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;

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

    max=s[0];
    maxP=0;
    min=s[0];
    minP=0;

    for(i=1;i<n;i++){
      if(max<s[i]){
        max=s[i];
        maxP=i;
      }
      else if(min>s[i]){
        min=s[i];
        minP=i;
      }
    }

    sum=0;
    for(i=0;i<n;i++)
      if(i!=maxP && i!=minP)
        sum+=s[i];

    printf("%d\n",sum/(n-2));
  }

  return 0;
}

Measured memory_bytes: 0
package main

import "fmt"

func main() {
	var N, A, B int
	fmt.Scan(&N, &A, &B)
	var cA, cB, cC int
	for i := 0; i < N; i++ {
		var t int
		fmt.Scan(&t)
		if t <= A {
			cA++
		} else if A < t && t <= B {
			cB++
		} else {
			cC++
		}
	}
	fmt.Println(min(cA, min(cB, cC)))
}
func min(a, b int) int {
	if a >= b {
		return b
	}
	return a
}


Measured memory_bytes: 512
n = int(input())
P =[]
s = 0
for _ in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for j in range(n):s += P[j][1]*P[j+1][0] -  P[j][0] * P[j+1][1]
print(s*-0.5)

Measured memory_bytes: 7716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll h;
    cin>>h;
    ll ans=1,n=1;
    while(h>1){
        h/=2;
        n*=2;
        ans+=n;
    }
    cout<<ans<<endl;
}


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

int main(){

    int n;
    cin >> n;
    vector<int> T(n);
    for (int i=0; i<n;i++){
        cin >> T.at(i);
    }
    int m;
    cin >> m;
    long long sum = 0;
    for (int i=0; i<m; i++){
        int p, x, buf;
        cin >> p >> x;
        p--;
        buf = T.at(p);
        T.at(p) = x;
        for (int j=0; j<n; j++) sum += T.at(j);
        cout << sum << endl;
        T.at(p) = buf;
        sum = 0;
    }
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=map(int,input().split())
b=[]
flag=0
for i in a:
    if i%2==0:
        b.append(i)
for i in b:
    if i%3==0 or i%5==0:
        flag+=1
if flag==len(b):
    print("APPROVED")
else:
    print("DENIED")

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

using namespace std;

int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;
  stringstream answer;
  for (int i = 0; i < S.length(); i++) {
    answer << S[i] << T[i];
  }
  cout << answer.str() << endl;

  return 0;
}


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

using namespace std;

int main()
{
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int n = min(a + b, c + c)*min(x, y);
	if (x < y) n += min(b, c + c)*(y - x);
	else n += min(a, c + c)*(x - y);
	cout << n << endl;
	return 0;
}


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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define MOD 1000000007


template<int64_t mod> struct Combination{
    vector<int64_t> f, rf;
 
    Combination(int max_n): f(max_n+1), rf(max_n+1){
        f[0] = 1;
        for(int i = 1;i <= max_n;i++) f[i] = f[i-1] * i % mod;
		int64_t a = f[max_n], inv = 1;
		for(int64_t b = mod-2;b > 0;b>>=1){
			if(b & 1) inv = inv*a % mod;
			a = a * a % mod;
		}
		for(int i = max_n;i >= 0;i--) inv = (rf[i] = inv) * i % mod;
    }
 
    int64_t operator()(int n, int r){
        return (r < 0 || n < r) ? 0 : f[n] * rf[r] % mod * rf[n-r] % mod;
    }
};

int pow_mod(int n, int m){
	int ans = 1;
	while(m > 0){
		if(m & 1) ans = (ans * n) % MOD;
		n = (n * n) % MOD;
		m >>= 1;
	}
	return ans;
}

signed main(){
	int k;
	cin >> k;
	string s;
	cin >> s;

	Combination<MOD> ncr(k+s.size());

	int ans = 0;
	for(int i = 0;i <= k;i++){
		int tmp = ncr(k-i+s.size()-1, k-i);
		tmp = (tmp * pow_mod(25, k-i)) %MOD;
		ans += (tmp * pow_mod(26, i)) %MOD;
		ans %= MOD;
	}

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


Measured memory_bytes: 35644
#include <stdio.h>
#include <string.h>
 
int main(){
    char tarou[1000],hanako[1000];
    int n,t=0,h=0;
     
    scanf("%d", &n);
    for(;n>0;n--){
        scanf(" %s %s", tarou, hanako);
        if(strcmp(tarou, hanako)>0){
            t+=3;
        }else if(strcmp(tarou, hanako)==0){
            t+=1;
            h+=1;
        }else if(strcmp(tarou, hanako)<0){
            h+=3;
        }
    }
     
    printf("%d %d\n",t,h);
     
    return 0;
 
}

Measured memory_bytes: 604
from collections import Counter

N,V = map(int,input().split())
cnt = 0

a = tuple(map(int,input().split()))
b = tuple(map(int,input().split()))
c = tuple(map(int,input().split()))
d = tuple(map(int,input().split()))

ab = Counter(ai+bi for ai in a for bi in b)
cd = Counter(ci+di for ci in c for di in d)

cnt = sum(ab[V-i]*t for i,t in cd.items() if V-i in ab)

print(cnt)

Measured memory_bytes: 219316
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

#define MOD 1000000007;//1e9+7

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

    if (K >= A + B)cout << "0 0";
    else if (K > A)cout << "0 " << B - K + A;
    else cout << A - K << " " << B;
}

Measured memory_bytes: 256
ac,wa,tle,re = 0,0,0,0
N = int(input())
for x in range(N):
  s = input()
  if s == "AC":
    ac += 1
  elif s == "WA":
    wa += 1
  elif s == "TLE":
    tle += 1
  elif s == "RE":
    re += 1
print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))

Measured memory_bytes: 9204
# 問題 https://atcoder.jp/contests/abc091/tasks/arc092_a
# 素晴らしくわかりやすい解説 https://speakerdeck.com/ichijyo/atcoder-beginner-contest-091-c-2d-plane-2n-points-fei-gong-shi-jie-shuo
# 別の解説　https://pitsbuffersolution.com/compro/atcoder/arc092c.php

# 解説が豊富な実装 https://atcoder.jp/contests/abc091/submissions/5250954

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
CD = [list(map(int, input().split())) for _ in range(N)]

# 青い点を基準に組み合わせの赤い点を探したい

# 赤い点も青い点もx座標をもとに並び替えたい
AB.sort()
CD.sort()

from operator import itemgetter


# 青い点について小さい順にマッチングさせていく
cnt = 0
for c, d in CD:
    # c,dよりも小さい中で一番大きいy座標が大きいものを選ぶ
    del_idx = None
    tmpmax = -1
    for i, (a, b) in enumerate(AB):
        if a < c and b < d:
            if b > tmpmax:
                # print('cd=({},{})'.format(c, d))
                # print('red=({},{})'.format(a, b))
                tmpmax = b
                del_idx = i

    if del_idx is not None:
        # print(del_idx)
        AB[del_idx] = [float('inf'), float('inf')]
        cnt += 1


print(cnt)


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

int main() {
  int a,b,c; 
 
  
  cin >> a >> b >> c ; 
  
  if ((a+b >= c)&&(a<=c)){
    cout << "YES" << endl;
  }
   
        else {
          cout <<"NO"<< endl;
        }
}
  
   
 




Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    Scanner(System.`in`).use {
        val n = it.nextInt()
        val x = it.nextInt()
        val xx = mutableListOf<Int>()

        for (i in 0 until n) {
            xx.add(Math.abs(it.nextInt() - x))
        }

        while (1 < xx.size) {
            if (xx[1] < xx[0]) {
                val tmp = xx[0]
                xx[0] = xx[1]
                xx[1] = tmp
            }

            val r = xx[1] % xx[0]
            
            if (r == 0) {
                xx.removeAt(1)
            } else {
                xx[1] = r
            }
        }

        println(xx[0])
    }
}


Measured memory_bytes: 55288
s=gets.chomp.split("").map(&:to_s)
q=gets.to_i

string=s
key=0

q.times.each do
    v=gets.chomp.split.map(&:to_s)
    v[0]=v[0].to_i
    v[1]=v[1].to_i
    
    if v[0]==1
        if key==0
            key=1
        else
            key=0
        end
        
    elsif v[0]==2
        if key==0 && v[1]==1
            string.unshift(v[2])
        elsif key==0 && v[1]==2
            string.push(v[2])
        elsif key==1 && v[1]==1
            string.push(v[2])
        elsif key==1 && v[1]==2
            string.unshift(v[2])
        end
    end
 

    
end


if key==1
    string=string.reverse
    puts string.join("")
else
    puts string.join("")
end

Measured memory_bytes: 35400
m,d=map(int,input().split())
d1=d%10
d10=(d-d1)//10
ans=0
for i in range(1,m+1):
  for j in range(2,d10):
    for l in range(2,10):
      if i==j*l:
        ans+=1
for i in range(1,m+1):
  for l in range(2,d1+1):
    if i==d10*l:
      ans+=1
print(ans)



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

using namespace std;

const int NS = ((int)5e5 + 4) * 160;
char in[NS], s[NS], t[NS], S[NS];
int fail[NS], kmp[NS], d[NS];
int inN, sN, tN, SN;

int main(){
    scanf("%s %s", in + 1, t + 1); inN = strlen(in + 1), tN = strlen(t + 1);
    while(sN < tN * 5){
        for(int i = sN + 1; i <= sN + inN; ++i){
            s[i] = in[i - sN];
        }
        sN += inN;
    }
    for(int i = 1; i <= sN; ++i) s[sN + i] = s[i];
    sN *= 2;
    for(int i = 2, j = 1; i <= tN; ++i){
        while(j > 1 && t[i] != t[j]) j = fail[j - 1] + 1;
        if(t[i] == t[j]) fail[i] = j++;
    }
    for(int i = 1, j = 1; i <= sN; ++i){
        while(j > 1 && s[i] != t[j]) j = fail[j - 1] + 1;
        if(s[i] == t[j]){
            kmp[i] = j++;
            if(j > tN){
                j = fail[j - 1] + 1;
            }
        }
    }
    int ans = 0;
    for(int i = 1; i <= sN; ++i){
        if(kmp[i] == tN){
            d[i] = 1;
            if(i - tN >= 0) d[i] += d[i - tN];
            ans = max(ans, d[i]);
        }
    }
    memset(fail, 0, sizeof(fail));
    memset(kmp, 0, sizeof(kmp));
    memset(d, 0, sizeof(d));
    while(SN < 20000000){
        for(int i = SN + 1; i <= SN + inN; ++i){
            S[i] = in[i - SN];
        }
        SN += inN;
    }
    for(int i = 1; i <= SN; ++i) S[SN + i] = S[i];
    SN *= 2;
    for(int i = 2, j = 1; i <= tN; ++i){
        while(j > 1 && t[i] != t[j]) j = fail[j - 1] + 1;
        if(t[i] == t[j]) fail[i] = j++;
    }
    for(int i = 1, j = 1; i <= SN; ++i){
        while(j > 1 && S[i] != t[j]) j = fail[j - 1] + 1;
        if(S[i] == t[j]){
            kmp[i] = j++;
            if(j > tN){
                j = fail[j - 1] + 1;
            }
        }
    }
    int Ans = 0;
    for(int i = 1; i <= SN; ++i){
        if(kmp[i] == tN){
            d[i] = 1;
            if(i - tN >= 0) d[i] += d[i - tN];
            Ans = max(Ans, d[i]);
        }
    }
    if(Ans > ans) puts("-1");
    else printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 991616
n = int(input())
lis = list(map(int,input().split()))
a = 1
i = 0
while a<= 10**18 and i <=n-1:
    a = a*lis[i]
    i = i + 1

if 0 in lis:
    print(0)
elif a > 10**18:
    print("-1")
else:
    print(a)

Measured memory_bytes: 21796
#include <iostream>

using namespace std;

main(){
  int n;
  while(1){
    cin >> n;
    if(n==0) break;

    int in[100];
    int sum=0;
    for(int i=0;i<n;i++){
      cin >> in[i];
      sum+=in[i];
    }

    int min=100000;
    int max=-1;
    for(int i=0;i<n;i++){
      if(min>in[i]) min=in[i];
      if(max<in[i]) max=in[i];
    }
    sum-=min;
    sum-=max;
    printf("%d\n", (int)(sum/(n-2)));
  }
  return 0;
}

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

int main()
{
	int n;
	float x[4], y[4];
	cin >> n;

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

		float l1, l2;
		l1 = (y[1] - y[0]) / (x[1] - x[0]);
		l2 = (y[3] - y[2]) / (x[3] - x[2]);
		if (l1 == l2){
			cout << "YES" << endl;
		}

		else {
			cout << "NO" << endl;
		}
	}
	return (0);
}

Measured memory_bytes: 1224