akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    string s;
    cin >> s;

    string ans = "";
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '0')
        {
            ans += '0';
        }
        else if (s[i] == '1')
        {
            ans += '1';
        }
        else if (s[i] == 'B' && ans.size() != 0)
        {
            ans.pop_back();
        }
    }

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

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>

using namespace std;

int n;
const int maxn = 3005;

int a[maxn];

typedef long long LL;

LL dp[maxn][maxn];

int main(){
    cin >> n;
    for(int i = 1;i <= n;i++){
        scanf("%d", &a[i]);
    }
    for(int i = 1;i <= n;i++){
        dp[i][i - 1] = 0;
    }
    for(int len = 1;len <= n;len++){
        for(int i = 1;i + len - 1 <= n;i++){
            int j = i + len - 1;
            dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]); 
        }
    }
    cout << dp[1][n] << endl;
    return 0;
}


Measured memory_bytes: 70016
#include <iostream>
#include <string>
using namespace std;
int main() {
int long N,AC,WA,TLE,RE;
  AC=0;
  WA=0;
  TLE=0;
  RE=0;
  cin>>N;
  
string S;

  for(int i=0;i<N;i++){
  cin>>S;
 if(S=="AC"){AC++;}
 if(S=="WA"){WA++;}
     if(S=="TLE"){TLE++;}
     if(S=="RE"){RE++;}
  }
cout<<"AC x "<<AC<<endl;
cout<<"WA x "<<WA<<endl;
cout<<"TLE x "<<TLE<<endl;
cout<<"RE x "<<RE<<endl;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> a(N), b(N), c(M), d(M);
  REP(i,N) cin >> a[i] >> b[i];
  REP(i,M) cin >> c[i] >> d[i];

  REP(i,N) {
    int res;
    int mn = INF;
    REP(j,M) {
      if(abs(a[i] - c[j]) + abs(b[i] - d[j]) < mn) {
        mn = abs(a[i] - c[j]) + abs(b[i] - d[j]);
        res = j;
      }
    }
    cout << res + 1 << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

struct Info{
	Info(int arg_town,int arg_cost){
		town = arg_town;
		cost = arg_cost;
	}
	bool operator<(const struct Info &arg) const{
			return cost > arg.cost;
	};
	int town,cost;
};

struct Dist{
	Dist(int arg_to,int arg_cost){
		to = arg_to;
		cost = arg_cost;
	}
	int to,cost;
};

struct Data{
	Data(int arg_start,int arg_goal){
		start = arg_start;
		goal = arg_goal;
	}
	int start,goal;
};

int main(){

	int N,R,s,t,d;
	scanf("%d %d",&N,&R);

	vector<Dist> V[N+1];
	int** MIN_COST = new int*[N+1];
	for(int i = 1; i <= N; i++){
		MIN_COST[i] = new int[N+1];
		for(int k = 1; k <= N; k++){
			if(i != k)MIN_COST[i][k] = BIG_NUM;
			else{
				MIN_COST[i][k] = 0;
			}
		}
	}

	for(int i = 0; i < R; i++){
		scanf("%d %d %d",&s,&t,&d);
		V[s].push_back(Dist(t,d));
		V[t].push_back(Dist(s,d));
	}

	int maximum = -1,min_index;
	stack<Data> S;
	priority_queue<Info> Q;
	queue<int> WORK;
	vector<int> ANS;
	vector<int> PRE_TOWN[N+1];

	bool* VISITED = new bool[N+1];

	for(int from = 1; from <= N;from++){

		for(int i = 1; i <= N; i++){
			PRE_TOWN[i].clear();
			PRE_TOWN[i].push_back(from);
		}

		for(int i = 0; i < V[from].size();i++){
			MIN_COST[from][V[from][i].to] = V[from][i].cost;
			Q.push(Info(V[from][i].to,V[from][i].cost));
		}

		while(!Q.empty()){
			if(Q.top().cost > MIN_COST[from][Q.top().town]){
				Q.pop();
				continue;
			}else{
				min_index = Q.top().town;
				Q.pop();
			}

			for(int i = 0; i < V[min_index].size(); i++){
				if(MIN_COST[from][V[min_index][i].to] > MIN_COST[from][min_index] + V[min_index][i].cost){
					MIN_COST[from][V[min_index][i].to] = MIN_COST[from][min_index] + V[min_index][i].cost;
					PRE_TOWN[V[min_index][i].to].clear();
					PRE_TOWN[V[min_index][i].to].push_back(min_index);
					Q.push(Info(V[min_index][i].to,MIN_COST[from][V[min_index][i].to]));
				}else if(MIN_COST[from][V[min_index][i].to] == MIN_COST[from][min_index] + V[min_index][i].cost){
					PRE_TOWN[V[min_index][i].to].push_back(min_index);
				}
			}
		}

		for(int i = 1; i <= N; i++){
			if(maximum <= MIN_COST[from][i]){
				if(maximum < MIN_COST[from][i]){
					ANS.clear();
				}
				maximum = MIN_COST[from][i];

				for(int k = 1; k <= N; k++)VISITED[k] = false;

				WORK.push(i);
				VISITED[i] = true;
				ANS.push_back(i);

				while(!WORK.empty()){
					for(int k = 0; k < PRE_TOWN[WORK.front()].size(); k++){
						if(VISITED[PRE_TOWN[WORK.front()][k]] == false){
							VISITED[PRE_TOWN[WORK.front()][k]] = true;
							ANS.push_back(PRE_TOWN[WORK.front()][k]);
							WORK.push(PRE_TOWN[WORK.front()][k]);
						}
					}
					WORK.pop();
				}
			}
		}
	}

	bool* USED = new bool[N+1];
	for(int i = 1; i <= N; i++)USED[i] = false;

	for(int i = 0; i < ANS.size(); i++)USED[ANS[i]] = true;

	int num = 0;

	for(int i = 1; i <= N; i++)if(USED[i] == false)num++;

	printf("%d\n",num);
	for(int i = 1; i <= N; i++){
		if(USED[i] == false){
			printf("%d\n",i);
		}
	}

   return 0;
}

Measured memory_bytes: 77080
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
using namespace std;

typedef long long ll;
typedef short int sh;

const int inf=0x3f3f3f3f;
const int MAX=2e5+10;
const int mod=1e9+7;

int b=101,t=-101,ans=inf;
int a[MAX];

void Fun(int k,int n)
{
    int temp=0;
    for(int i=0;i<n;i++)
    {
        temp+=(a[i]-k)*(a[i]-k);
    }
    ans=min(ans,temp);
}

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        b=101;   t=-101;
        ans=inf;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            t=max(t,a[i]);
            b=min(b,a[i]);
        }
        for(int i=b;i<=t;i++)
        {
            Fun(i,n);
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	priority_queue<int> ans;
	forn(i, n) {
		int input; scanf("%d", &input);
		ans.push(input); 
	}
	while(m--) {
		int x = ans.top(); ans.pop();
		x /= 2; ans.push(x);
	}
	long long count = 0;
	while(!ans.empty()) {
		int x = ans.top(); ans.pop();
		count += x;
	}
	printf("%ld", count);
}










Measured memory_bytes: 892
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var s = cin.next();
            var di = new Dictionary<string, int>();
            di.Add("SUN", 7);
            di.Add("MON", 6);
            di.Add("TUE", 5);
            di.Add("WED", 4);
            di.Add("THU", 3);
            di.Add("FRI", 2);
            di.Add("SAT", 1);

            Console.WriteLine(di[s]);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N+ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }   

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    for (int i=1; i<=n; ++i) {
        int a;
        cin >> a;
        if (a%2 == 1) continue;
        if (a%3 != 0 && a%5 != 0) {
            cout << "DENIED" << endl;
            return 0;
        }
    }

            cout << "APPROVED" << endl;

    return 0;
}

Measured memory_bytes: 256
//
// Created by yamunaku on 2020/01/26.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<pair<ll, ll>> mon(n);
    rep(i, n){
        cin >> mon[i].first >> mon[i].second;
    }
    sort(all(mon));
    ll ans = 0;
    queue<pair<ll, ll>> q;
    ll tmp = 0;
    rep(i, n){
        while(!q.empty()){
            if(q.front().first >= mon[i].first) break;
            tmp -= q.front().second;
            q.pop();
        }
        ll k = max(0ll, (mon[i].second + a - 1) / a - tmp);
        ans += k;
        tmp += k;
        q.push({mon[i].first + 2 * d, k});
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6656
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100


struct Edge{
	Edge(int arg_to,int arg_capacity,int arg_rev_index){
		to = arg_to;
		capacity = arg_capacity;
		rev_index = arg_rev_index;
	}
	int to,capacity,rev_index;
};

int V,E;

vector<Edge> G[NUM];
int dist[NUM];
int cheked_index[NUM];


void add_edge(int from,int to,int capacity){
	G[from].push_back(Edge(to,capacity,G[to].size()));
	G[to].push_back(Edge(from,0,G[from].size()-1));
}

void bfs(int source){
	for(int i = 0; i < V; i++)dist[i] = -1;
	queue<int> Q;
	dist[source] = 0;
	Q.push(source);

	while(!Q.empty()){
		int node_id = Q.front();
		Q.pop();
		for(int i = 0; i < G[node_id].size(); i++){
			Edge &e = G[node_id][i];
			if(e.capacity > 0 && dist[e.to] < 0){
				dist[e.to] = dist[node_id]+1;
				Q.push(e.to);
			}
		}
	}
}

int dfs(int node_id,int sink,int flow){
	if(node_id == sink)return flow;

	for(int &i = cheked_index[node_id]; i < G[node_id].size(); i++){
		Edge &e = G[node_id][i];
		if(e.capacity > 0 && dist[node_id] < dist[e.to]){
			int tmp_flow = dfs(e.to,sink,min(flow,e.capacity));
			if(tmp_flow > 0){
				e.capacity -= tmp_flow;
				G[e.to][e.rev_index].capacity += tmp_flow;
				return tmp_flow;
			}
		}
	}
	return 0;
}


int max_flow(int source,int sink){
	int flow = 0,add;
	while(true){
		bfs(source);
		if(dist[sink] < 0)break;
		for(int i = 0; i < V; i++)cheked_index[i] = 0;
		while((add = dfs(source,sink,BIG_NUM)) > 0){
			flow += add;
		}
	}
	return flow;
}


int main(){

	scanf("%d %d",&V,&E);

	int from,to,cost;

	for(int loop = 0; loop < E; loop++){
		scanf("%d %d %d",&from,&to,&cost);
		add_edge(from,to,cost);
	}

	printf("%d\n",max_flow(0,V-1));

	return 0;
}



Measured memory_bytes: 3248
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static List<Integer>[] P;
	public static void main(String []args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int m = Integer.parseInt(sc.next());
		
		int []d = new int [n];
		for(int i = 0 ; i < n ;i++) {
			d[i] = Integer.parseInt(sc.next());
		}
		P = new ArrayList [n];
		for(int i = 0 ; i < n ;i++) {
			P[i] = new ArrayList <Integer>();
		}
		
		for(int i = 0 ; i < m ;i++) {
			int a = Integer.parseInt(sc.next())-1;
			int b = Integer.parseInt(sc.next())-1;
			P[a].add(b);
			P[b].add(a);
		}
		int ans = 0;
		
		for(int i = 0 ; i < n ;i++) {
			int temp = d[i];
			boolean jdg = true;
			for(int num : P[i]) {
				if(d[num] >= temp) {
					jdg = false;
					break;
				}
			}
			if(jdg) {
				ans++;
			}
		}
		System.out.println(ans);
	}

}


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

int main()
{
    char s[1005];
    int i,p,x[26]={0},sign=0;
    cin>>s;
    for(i=0;i<strlen(s);i++)
    {
        p=s[i]-'a';
        x[p]++;
    }
    for(i=0;i<26;i++)
    {
        if(x[i]%2==0)
        {
            sign=1;
        }
        else
        {
            sign=0;break;
        }
    }
    if(sign==0)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    int ans = 0;
    for(int i=1; i<=n;i++){
        ans += i;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, S = lr()
A = lr()
MOD = 998244353
dp = [0] * (S+1)

answer = 0
for a in A:
    dp[0] += 1
    for x in range(S, a-1, -1):
        dp[x] += dp[x-a]
    answer += dp[-1]
    answer %= MOD

print(answer%MOD)


Measured memory_bytes: 66268
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    n = N * (N - 1) // 2 + M * (M - 1) // 2
    print(n)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


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

int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> c(n + 1);
  for (int i = 0; i < n - 1; ++i) {
    c[i + 1] = c[i] + (s[i] == 'A' && s[i + 1] == 'C');
  }
  while (q--) {
    int l, r;
    cin >> l >> r;
    --l, --r;
     cout << c[r] - c[l] << endl;
  }
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
int main(){
    int a,b,c,d,p,x,y,z;
    std::cin>>a>>b>>c>>d>>p;
    x=a*p;
    if(c>p){
        y=b;
        std::cout<<std::min(x,y)<<std::endl;
    }else{
        z=(p-c)*d+b;
        std::cout<<std::min(x,z)<<std::endl;
    }
    return 0;
}



Measured memory_bytes: 3116
def gcd(x, y):
    if y == 0 :
        return x
    else:
        return gcd(y,x%y)
def prime(x):
    global  ans
    m = x ** (0.5)
    for i in range(2,int(m+1)):
        if x % i == 0 :
            while True:
                if x % i != 0 :
                    break
                else:
                    x = (x//i)
            ans +=1
    if x != 1 :
        ans += 1
    return ans
A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
print(prime(t))

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

using namespace std;
typedef long long ll;

double X;

int main(){
    cin >> X;
    ll x = 100.0;
    for(int i=1;i<4000;i++){
        x *= 1.01;
        if(x >= X){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    ll n, a, b;
    cin >> n >> a >> b;
    cout << max((((n - 1) * b + a) - ((n - 1) * a + b)) + 1, 0ll) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//useful 
#define rep(i,n) for(int i = 0; i < (n); i++)
int long long gcd(int long long a, int long long b){
    return b?gcd(b,a%b):a;
} //最大公約数
int long long lcm(int long long a, int long long b){
    return a/gcd(a,b)*b;
} //最小公倍数
int long long GetDigit(int long long num){
    int long long digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
} //桁数
int long long GetDigitN(int long long num, int long long N){
    int long long digit=0;
    while(num!=0){
        num /= N;
        digit++;
    }
    return digit;
} //十進数でnumの際のN進数における桁数
int long long divisorcount(int long long n){
	int long long ans = 1;
	vector<int> x(n + 1);
	int long long num = n; // 素因数分解する変数num 
	for (int long long i = 2; i <= n; i++) {
		while (num%i == 0) { // 素数で割り切れなくなるまで割っていく
			x.at(i)++; //割った個数を配列に足す
			num /= i;
		}
	}
	for (int i = 2; i <= n; i++){	
		ans *= x.at(i) + 1; //それぞれを+1して掛けていく
	}
    return ans;
} //約数カウント

int main(){
    int N, D;
    cin >> N >> D;
    vector<vector<int>> V(N, vector<int>(2));
    for(int i = 0; i < N; i++){
        cin >> V.at(i).at(0);
        cin >> V.at(i).at(1);
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        double A = pow(V.at(i).at(0),2) + pow(V.at(i).at(1),2);
        if(sqrt(A) <= D){
            ans = ans + 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14344
import java.util.Scanner;

public class Main {

    public static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args) {
        char c= scanner.next().charAt(0);
        if(c-'A'<26)
        {
            System.out.println("A");
        }
        else
        {
            System.out.println("a");
        }
	// write your code here
    }
}

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

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

bool X[N][N];


void initialize(){
  int i;

  for(i=0;i<N;i++){
      row[i]=FREE,col[i]=FREE;
  }
  for(i=0;i<N;i++){
      dpos[i]=FREE,dneg[i]=FREE;
  }
}

void printBoard(){
  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
	    if(X[i][j]){
	       if(row[i]!=j) return;
	    }
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
	  cout << ((row[i]==j)?"Q":".");
	  }
    cout << endl;
  }
}

void recursive(int i){
  int j;
  if(i==N){
    printBoard();return;
  }

  for(j=0;j<N;j++){
    if(NOT_FREE==col[j] || NOT_FREE == dpos[i+j] || NOT_FREE == dneg[i-j+N-1]){
	  continue;
	  }
    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;

    recursive(i+1);

    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}

int main(){
  initialize();

  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
	    X[i][j]=false;
    }
  }

  int k;
  cin >> k;
  for(i=0;i<k;i++){
    int r,c;
    cin >> r >> c;
    X[r][c]=true;
  }

  recursive(0);

  return 0;
}



Measured memory_bytes: 3088
N, M, C = map(int, input().split())
B_lis = list(map(int, input().split()))

ans = 0
for n in range(N):
  A_lis = list(map(int, input().split()))
  s = 0
  for a,b in zip(A_lis, B_lis):
    s += a*b
  s += C
  if s > 0:
    ans += 1
print(ans)

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

int main(){
  string s;
  std::cin >> s;
  for (int i = 0; i < s.length() - 1; i++) {
    if(s[i] == 'A' and s[i + 1] == 'C'){
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    string s; cin >> s;
    vector<int> n(s.size());

    for (int i = 0; i < s.size(); ++i) {
        n[i] = s[i] == '1' ? 1 : 0;
    }

    int ope = 1e7;
    int count = 0;
    for (int i = 0; i < n.size(); ++i){
        if (i % 2 == n[i]) {
            ++count;
        }
    }
    ope = min(count, ope);

    count = 0;
    for (int i = 0; i < n.size(); ++i){
        if ((i + 1) % 2 == n[i]) {
            ++count;
        }
    }
    ope = min(count, ope);

    cout << ope <<  endl;
}


Measured memory_bytes: 896
import numpy as np

n, k = map(int, input().split())
h_arr = np.array(list(map(int, input().split())))
cost_arr = np.zeros(n, dtype=int)
for i in range(1, n):
    start = max(i-k, 0)
    cost_arr[i] = (abs(h_arr[start:i] - h_arr[i]) + cost_arr[start:i]).min()
print(int(cost_arr[-1]))


Measured memory_bytes: 22832
#include <stdio.h>
#include <string.h>
#define MV 0x7FFFFFFF

int main(void){
	int i, j, k, l, m[51], n, p, x[4][51][10], y[4][51][10], sum, minx, miny, tmpx, tmpy, flag[51];
	while(1){
		scanf("%d",&n);
		if(n == 0)
			break;
		for(i = 0;i <= n;i++){
			scanf("%d",&m[i]);
			minx = MV, miny = MV;
			for(j = 0;j < m[i];j++){
				scanf("%d%d",&x[0][i][j],&y[0][i][j]);
				if(x[0][i][j] < minx)
					minx = x[0][i][j];
				if(y[0][i][j] < miny)
					miny = y[0][i][j];
			}
			for(j = 0;j < m[i];j++){
				x[0][i][j] = x[0][i][j] - minx;
				y[0][i][j] = y[0][i][j] - miny;
			}
			for(j = 0;j < 3;j++){
				for(k = 0;k < m[i];k++){
					x[j + 1][i][k] = -y[j][i][k];
					y[j + 1][i][k] = x[j][i][k];
				}
			}
		}
		memset(flag,0,sizeof(flag));
		for(i = 1;i <= n;i++){
			if(m[0] == m[i]){
				for(k = 0;k < 4;k++){
					for(l = 0;l < 4;l++){
						tmpx = x[k][0][0] - x[l][i][0];
						tmpy = y[k][0][0] - y[l][i][0];
						for(p = 1;p < m[0];p++){
							if(tmpx != x[k][0][p] - x[l][i][p] || tmpy != y[k][0][p] - y[l][i][p])
								break;
						}
						if(p == m[0]){
							flag[0] = flag[i] = 1;
							break;
						}
						tmpx = x[k][0][0] - x[l][i][m[i] - 1];
						tmpy = y[k][0][0] - y[l][i][m[i] - 1];
						for(p = 1;p < m[i];p++){
							if(tmpx != x[k][0][p] - x[l][i][m[0] - 1 - p] || tmpy != y[k][0][p] - y[l][i][m[0] - 1 - p])
								break;
						}
						if(p == m[0]){
							flag[i] = 1;
							break;
						}
					}						
					if(l != 4)
						break;
				}
			}
		}
		sum = 0;
		for(i = 1;i <= n;i++)
			if(flag[i]) printf("%d\n",i);
		printf("+++++\n");
	}
	return 0;
}

Measured memory_bytes: 1056
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

typedef int _lcint;
#define REP(i, n) for (_lcint i = 0; i < n; i++)
#define FOR(i, a, b) for (_lcint i = (_lcint)(a); i < (_lcint)(b); i++)
#define FORREV(i, n) for (_lcint i = (_lcint)(b)-1; i >= (_lcint)(a); i--)
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v)  \
  cout << #v << ": "; \
  REP(i, v.size()) cout << " " << v[i] << endl;

#define ALL(a) (a).begin(), (a).end()
#define CHMIN(a, b) a = min((a), (b))
#define CHMAX(a, b) a = min((a), (b))

int main() {
  int H, W;
  cin >> H >> W;
  int h, w;
  cin >> h >> w;

  cout << ((H - h) * (W - w));

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<utility>
#include <numeric>
 
using namespace std;
typedef long long ll;
 
int main(){
ll n;
string a,b,c;
cin>>n>>a>>b>>c;
ll count=0;
for(ll i=0;i<n;i++){
if(a[i]==b[i]&&b[i]==c[i]){
}
else if(a[i]==b[i]||b[i]==c[i]||a[i]==c[i]){
count++;
}
else
count+=2;
}
cout<<count<<endl;
  return 0;
 
}
 

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int w, h, n;
int a[105][105];

int main()
{
	cin >> w >> h >> n;

	for (int k = 0; k < n; ++k)
	{
		int x, y, z;

		cin >> x >> y >> z;

		if (z == 1)
		{
			for (int i = 0; i < x; ++i)
				for (int j = 0; j < h; ++j)
					a[i][j] = 1;
		}

		if (z == 2)
		{
			for (int i = x; i < w; ++i)
				for (int j = 0; j < h; ++j)
					a[i][j] = 1;
		}

		if (z == 3)
		{
			for (int i = 0; i < w; ++i)
				for (int j = 0; j < y; ++j)
					a[i][j] = 1;
		}

		if (z == 4)
		{
			for (int i = 0; i < w; ++i)
				for (int j = y; j < h; ++j)
					a[i][j] = 1;
		}
	}

	int res = 0;
	for (int i = 0; i < w; ++i)
		for (int j = 0; j < h; ++j)
			if (!a[i][j])
				++res;

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i;	
  string x,y;
  cin>>x;
  y=x;
  reverse(x.begin(),x.end());
  for(i=0;i<x.size();i++)
    {
      if(x[i]=='b') 
	    x[i]='d';
      else 
	    if(x[i]=='d') 
		  x[i]='b';
      else 
	    if(x[i]=='p') 
		  x[i]='q';
      else 
	    if(x[i]=='q') 
		  x[i]='p';
    }
  if(x==y) 
	cout<<"Yes"<<endl;
  else 
	cout<<"No"<<endl;
  return 0;
}

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

using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

class BIT{
public:
    vector<int> bit;
    int N;
    BIT(int n){
        N = n;
        bit = vector<int>(N + 1);
    }
    void add(int idx, int val){
        for(;idx <= N; idx += idx & (-idx))bit[idx] += val;
    }
    int pref(int idx){
        int ret = 0;
        for(;idx > 0; idx -= idx & (-idx))ret += bit[idx];
        return ret;
    }
};

int n ,k;
void solve() {
    cin >> n >>k;

    ordered_set st;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
        st.insert(v[i]);
    }
    for(auto &x: v)x = st.order_of_key(x + 1);
    int N = *max_element(v.begin() ,v.end());
    BIT a(N) , b(N);
    for(auto x: v)a.add(x, 1);
    int ans = 0;

    auto put = [](int a){
        int tp = (k *(k - 1))/2;
        tp %= MOD;
        return a * tp % MOD;
    };

    for(int i = 0; i < n; i++){
        ans = (ans + (b.pref(N) - b.pref(v[i])) * k % MOD) % MOD;
        ans = (ans + (put(a.pref(v[i] - 1)))) % MOD;
        b.add(v[i], 1);
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


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

int main() {
	int64_t n, k; cin >> n >> k;
	int64_t a[3]; for(int i = 0; i < 3; ++i) cin >> a[i];
	string s; cin >> s;
	int64_t ans = 0;
	for(int i = 0; i < k; ++i) {
		vector<int64_t> pre(3);
		vector<int64_t> nxt(3);
		for(int j = i; j < n; j += k) {
			for(int l = 0; l < 3; ++l) {
				nxt[l] = max(pre[(l + 1) % 3], pre[(l + 2) % 3]);
			}
			if(s[j] == 'r') nxt[2] = max(nxt[2], max(pre[0], pre[1]) + a[2]);
			if(s[j] == 's') nxt[0] = max(nxt[0], max(pre[1], pre[2]) + a[0]);
			if(s[j] == 'p') nxt[1] = max(nxt[1], max(pre[2], pre[0]) + a[1]);
			pre = nxt;
		}
		int64_t tmp = 0;
		for(int j = 0; j < 3; ++j) {
			tmp = max(tmp, pre[j]);
		}
		ans += tmp;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int a, b;
	cin >> a >> b;
	if(a != b) {
		if(a < b) {
			swap(a, b);
		}
		
		for(int i = 0; i < a; i++) cout << b;
	} else for(int i = 0; i < a; i++) cout << b;
	
	cout << endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 3492
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  bitset<2010*2010>dp;
  dp[0]=1;
  for(int i=0;i<N;i++)
    dp=dp|(dp<<A[i]);
  int64_t sum=1;
  for(int i=0;i<N;i++)
    sum+=A.at(i); sum/=2;
  int64_t ans=sum;
  for(int64_t i=sum;i<=4000000;i++)
    if(dp[i]){ans=i;break;}
  cout<<ans<<endl;
  return 0;
}

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

int getResult(const int ball, const int color){
  int result = color;
  for(int i = 1; i < ball; i++){
    result *= (color - 1);
  }
  return result;
}

int main(){
  int N, K;
  cin >> N >> K;
  
  int result = getResult(N, K);
  cout << result;
  return 0;
}

Measured memory_bytes: 3188
#include<stdio.h>
#include<math.h>

int main(void){
  int n,t,a,h,ans;
  double diff[1000],min = 1000000;
  scanf("%d",&n);
  scanf("%d %d",&t,&a);
  
  for(int i = 0;i <n;i++){
    scanf("%d",&h);
    diff[i] = fabs(a -( t -h * 0.006));
  }
  
  for(int i = 0;i <n;i++){
    if(diff[i] < min)min = diff[i],ans = i + 1;
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 128
IDENTIFICATION DIVISION.
PROGRAM-ID. A-Task.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP      PIC X(100).
01 A1       PIC 9(3).
01 A2       PIC 9(3).
01 A3       PIC 9(3).
 
01 OUT-COST PIC ZZ9.
 
PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO A1 A2 A3.
 
  EVALUATE TRUE
    WHEN (A1 <= A2 AND A1 >= A3) OR
         (A1 >= A2 AND A1 <= A3)
      COMPUTE OUT-COST = A2 - A3    
    WHEN (A2 <= A1 AND A2 >= A3) OR
         (A2 >= A1 AND A2 <= A3)
      COMPUTE OUT-COST = A1 - A3    
    WHEN OTHER
      COMPUTE OUT-COST = A1 - A2    
  END-EVALUATE.

  DISPLAY OUT-COST.
 
MAIN-EXIT.
  STOP RUN.

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

#define pb push_back

void solve(){
  ll k,s; cin>>k>>s;
  ll count=0;
  for(int i=0;i<=k;i++)
    for(int j=0;j<=k;j++)
      if(s-i-j>=0 && s-i-j<=k) count++;
cout<<count<<endl;
}


int main() {
   #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif

 ios_base::sync_with_stdio(0);
 cin.tie(0);

int t=1 ;  while(t--)
 solve();

return 0;
}


Measured memory_bytes: 3548
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        
        List<Integer> list = new ArrayList<>(100000);
        for (int i = A; i < Math.min(A+K, B); i++) {
        	list.add(i);
        }
        
        for (int i = Math.max(B-K+1, A); i <= B; i++) {
        	list.add(i);
        }
        
        
        list.stream().distinct().sorted().forEach(System.out::println);
        
    }
    
}

Measured memory_bytes: 28756
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

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

const ll INF=1LL << 60;

ll xs[100005];

ll gcd(ll x,ll y){
  if(!(x%y))return y;
  else return gcd(y,x%y);
}

int main() {
  ll n,x;cin >> n >> x;
  rep(i,n) cin >> xs[i];
  //if(n==1 && x==xs[0]){cout << 0;return 0;}
  vector<ll> diff;
  rep(i,n){
    diff.pb((ll)abs(xs[i]-x));
    
  }
  sort(ALL(diff));
  ll ans= diff.front();
  for(int i=1;i<n;i++){if(diff[i])ans=gcd(ans,diff[i]);}

  cout << ans;
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
string s;
bool check(int l, int r){
 bool ok = true;
 while(l <= r){
    if(s[l] != s[r]){
      ok = false;
      break;
    }
    l++;
    r--;
  }
  return ok;
}
int main(){
  cin>>s;
  int n = s.length();
  int l = 0, r = n-1;
  bool ok;
  ok = check(l, r);
  if(ok){
    l = 0, r = ((n-1)/2)-1;
    ok = check(l, r);
    if(ok){
      l = (n+3)/2-1, r = n-1;
      ok = check(l, r);
    }
  }
  if(ok)
    cout<<"Yes";
  else{
    cout<<"No";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }    
    sort(a.begin(),a.end(),greater<int>());
    vector<int> b;

    for(int i=0;i<n;i++){
        b.push_back(a[i]);
        if(0==i) continue;
        b.push_back(a[i]);
    }
    ll ans=0;
    for(int i=0;i<n-1;i++){
        ans+=b[i];
    }
    
    cout<<ans;
    return 0;
}

Measured memory_bytes: 6148
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def solve():
	H, W = MAP()
	A = [input() for _ in range(H)]

	count = [[0]*W for _ in range(H)]
	q = deque([])

	for i in range(H):
		for j in range(W):
			if A[i][j] == "#":
				q.append((i, j))
	# print(q)

	dy = [1, 0, -1, 0]
	dx = [0, -1, 0, 1]

	while len(q) >= 1:
		i, j = q.popleft()
		# print(i, j)
		for x, y in zip(dx, dy):
			ny = i + y
			nx = j + x
			if 0 <= nx <= W-1 and 0 <= ny <= H-1 and count[ny][nx] == 0 and A[ny][nx] != "#":
				count[ny][nx] = count[i][j] + 1
				q.append((ny, nx))

	ans = 0
	for i in range(H):
		ans = max(ans, max(count[i]))
	# print(count)
	print(ans)

if __name__ == "__main__":
	solve()


Measured memory_bytes: 107864
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n,m,k,x,y,dir[4][2]={1,0,-1,0,0,1,0,-1},u[850][850];
char a[850][850];
struct node {
    int x;
    int y;
    int step;
};
int judge(int x,int y){
    if(x<1 || x>n || y<1 || y>m)
        return 1;
    if(u[x][y] == 1 || a[x][y] == '#')
        return 1;
    return 0; 
}
void bfs(){
    node init;
    queue<node> q;
    node next;
    init.x = x;
    init.y = y;
    init.step = 0;
    u[x][y] = 1;
    q.push(init);
    while(!q.empty()){
        node tmp = q.front();
        q.pop();
        for(int i=0;i<4;i++){
            next.x = tmp.x+dir[i][0];
            next.y = tmp.y+dir[i][1];
            if(judge(next.x,next.y)) continue;
            a[next.x][next.y]='c';
            next.step = tmp.step+1;
            u[next.x][next.y] = 1;
            if(next.step<k)q.push(next);
        }
    }
}
int main(){
    while(cin>>n>>m>>k){
        memset(u,0,sizeof(u));
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                cin>>a[i][j];
                if(a[i][j]=='S')x=i,y=j;
            }
        }
        bfs();
        int ans=1000;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(a[i][j]=='S'||a[i][j]=='c'){
                    for(int l=0;l<4;l++){
                        int num=1;
                        int numx=0,numy=0;
                        if(dir[l][0]==-1)numx=i-1;
                        else if(dir[l][0]==1)numx=n-i;
                        if(dir[l][1]==-1)numy=j-1;
                        else if(dir[l][1]==1)numy=m-j;
                        num+=(numx+numy)/k;
                        if((numx+numy)%k)num++;
                        //cout<<i<<" "<<j<<" "<<l<<" "<<num<<" "<<numx<<" "<<numy<<endl;
                        ans=min(ans,num);
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

using namespace std;

//#define MD 100010

int main(){
    int n,l;
    cin>>n>>l;
    vector<string> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    
    sort(v.begin(),v.end());
    
    for(int i=0;i<n;i++){
        cout<<v[i];
    }
    cout<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	while(1) {
		int n;					//審判の人数
		int ans = 0, max, min, temp;
		vector<int> points;		//点数を取得する

		cin >> n;	//以降のループ回数を取得する
		if( n == 0 ) break;	//ループ終了処理
		
		//点数を取得する
		for(int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp;
			points.push_back(tmp);
			ans += tmp;
		}

		//最大値を取得する
		temp = -1;
		for(int i = 0; i < n; i++) 
			if(temp < points.at(i)) temp = points.at(i);
		max = temp;
		//最小値を取得する
		for(int i = 0; i < n; i++)
			if(temp > points.at(i)) temp = points.at(i);
		min = temp;

		//答えから最大値・最小値を一つづつ除く
		ans -= (max + min);
		//平均を取得する
		ans /= (n - 2);


		//出力
		cout << ans << endl;
	}

	//while(1){}
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>

using namespace std;

int main()
{
	int X;
  
  	cin >> X;
	
	int num = X / 100;
	int remain = X % 100;
	
	if (remain <= num * 5) {
		cout << "1";
	}
	else {
		cout << "0";
	}
}

Measured memory_bytes: 256
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
b=a.cumsum()
from collections import Counter
c=Counter(b)
ans=0
if 0 in c:
  ans+=c[0]
for ci in c.values():
  ans+=(ci*(ci-1))//2
print(ans)

Measured memory_bytes: 39592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int main(){
	int n=read();
	printf("%d\n",3*n*n);
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"

using namespace std;
typedef long long ll;


ll sum(int n, ll x)
{
  vector<ll> power_2(55);
  power_2[0] = 1;
  for (int i = 1; i < 55; i++)
  {
    power_2[i] = 2 * power_2[i - 1];
  }
  if (n == 0)
  {
    if (x == 0)
    {
      return 0;
    }
    else
    {
      return 1;
    }
  }

  else
  {
    if (x == 0)
    {
      return 0;
    }
    if (x > 0 && x < power_2[n + 1] - 1)
    {
      return sum(n - 1, x - 1);
    }
    if (x >= power_2[n + 1] - 1)
    {
      return power_2[n + 1] - 1 - sum(n, power_2[n + 2] - 3 - x);
    }
  }
}

int main()
{
  int n;
  cin >> n;
  ll x;
  cin >> x;
  cout << sum(n, x) << endl;
}

Measured memory_bytes: 256
import math


def prime_factors(n):
    count = {2: 0}

    while n % 2 == 0:
        n = n / 2
        count[2] += 1

    for i in range(3, int(math.sqrt(n))+1, 2):
        count[i] = 0
        while n % i == 0:
            n = n / i
            count[i] += 1

    if n > 2:
        if int(n) in count:
            count[int(n)] += 1
        else:
            count[int(n)] = 1
    # print(count)
    ans = 0
    for k in count.values():
        if k:
            j = int((2*k)**0.5)
            while j*(j+1) <= 2*k:
                j += 1
            ans += j-1

    return ans


n = int(input())

print(prime_factors(n))


Measured memory_bytes: 50900
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
#define task "tst"
using namespace std;
const ll N = 3e5 + 9;
const ll inf = 1e9 + 7;
typedef pair<ll,ll> LL;
vector<ll> g[N];
ll n,x,y,d[N],res[N],i;
void BFS(ll scr){
    fill(d,d + n + 1,inf);
    d[scr] = 0;
    queue<ll> q; q.push(scr);
    while(!q.empty()){
        ll t = q.front(); q.pop();
        for (auto i : g[t]){
            if (d[i] > d[t] + 1){
                d[i] = d[t] + 1;
                q.push(i);
            }
        }
    }
    for (ll i = 1;i <= n;i++) res[d[i]]++;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>n>>x>>y;
    g[x].push_back(y);
    g[y].push_back(x);
    for (i = 1;i < n;i++){
        g[i].push_back(i + 1);
        g[i + 1].push_back(i);
    }
    for (i = 1;i <= n;i++) BFS(i);
    for (i = 1;i < n;i++) cout<<res[i]/2<<"\n";
}


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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  int n;
  cin >> n;
  VI p(n);
  rep(i,n){
    cin >> p[i];
  }
  VI r(n);
  rep(i,n){
    r[p[i]-1] =  i+1;
  }
  FOR(i,1,n+1) {
    if(i != n) cout << i * 30000 <<  " ";
    else       cout << i * 30000 <<  endl;
  }
  FOR(i,1,n+1){
    if(i != n) cout << (n-i) * 30000 + r[i-1] <<  " ";
    else       cout << (n-i) * 30000 + r[i-1] <<  endl;
  }
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

using P = pair<int, int>;

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

  int n;
  cin >> n;

  vector<int> p(n), q(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];

  int num = 0;
  int a, b;

  auto f = [](const vector<int>& s, const vector<int>& t) {
    for (int i = 0; i < s.size(); i++) if (s[i] != t[i]) return false;
    return true;
  };

  vector<int> order(n);
  rep(i, n) order[i] = i + 1;

  do {
    num++;
    if (f(p, order)) a = num;
    if (f(q, order)) b = num;
  } while (next_permutation(order.begin(), order.end()));

  cout << abs(a - b) << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>

int main(void) {
 
  // 入力
  int n;
  scanf("%d",&n);
  int listA[n+1],listB[n];
  for(int i=0;i<=n;i++){
    scanf("%d",&listA[i]);
  }
  for(int i=0;i<n;i++){
    scanf("%d",&listB[i]);
  }
  
  long long int result=0;
  for(int i=0;i<n;i++){
    if(listA[i]<listB[i]){
      listB[i]-=listA[i];
      result+=listA[i];
      listA[i]=0;
      if(listA[i+1]<listB[i]){
        listB[i]-=listA[i+1];
        result+=listA[i+1];
        listA[i+1]=0;
      }else{
        result+=listB[i];
        listA[i+1]-=listB[i];
        listB[i]=0;
      }
    }else{
      result+=listB[i];
      listA[i]-=listB[i];
      listB[i]=0;
    }
  }

  printf("%lld\n",result);  

  return 0;
}

Measured memory_bytes: 896