akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<double> A(N);
  double sum = 0;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    sum += 1/A[i];
  }
  cout << setprecision(10) << 1/sum;
 }

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
MOD = 10**9 + 7
def comb(n, k, mod):
    if n<0 or k<0 or n<k:
        return 0
    if n==0 or k==0:
        return 1
    k=k if k<=n-k else n-k
    x = 1
    y = 1
    for i in range(k):
        x=x*(n-i)%mod
        y=y*(i+1)%mod
    return (x*pow(y,mod-2,mod))%mod
n,a,b = map(int,input().split())
A = comb(n,a,MOD)
B = comb(n,b,MOD)
C = pow(2,n,MOD)
ans = C -A-B-1
print(ans%MOD)

Measured memory_bytes: 38512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 998244353;
vel par;
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; ans %= p; }
	return ans;
}
int root1(int ser, vel &path) {
	if (par[ser] == -1) {
		for (int i = 0; i < path.size(); i++) {
			par[path[i]] = ser;
		}
		return ser;
	}
	path.push_back(ser);
	return root1(par[ser], path);
}
int root(int ser) {
	vel emp(0);
	return root1(ser, emp);
}
bool uni(pin a) {
	int x = root(a.first);
	int y = root(a.second);
	if (x != y) {
		par[y] = x;
	}
	return (x != y);
}
signed main() {
	int n, x; cin >> n >> x;
	vel a(n);
	int sum = 0;
	rep(i, n) { cin >> a[i]; sum += a[i]; }
	if (sum < x) { cout << n - 1 << endl; }
	else if (sum == x) { cout << n << endl; }
	else {
		sor(a);
		int ind = 0;
		while (x >= 0 and ind<n) {
			x -= a[ind]; ind++;
		}
		cout << ind-1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int x[8], y[8];
    
    for (int i = 0; i < N; i++)
        cin >> x[i] >> y[i];
        
    double d = 0;
    int count = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            d += pow(pow(x[i]-x[j], 2) + pow(y[i]-y[j], 2), 0.5);
            count++;
        }
    }
    
    d = d / count * (N-1);
    
    cout << fixed << setprecision(8) << d << endl;
}

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

int a[100010];
int main()
{
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)	cin>>a[i];
	int ans = 0;
	for(int i=1;i<=n;i++){
		if(a[i]==i)	ans++,i++;
	}
	cout<<ans<<'\n';
	return 0;
} 

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

int main(){
	long long x;
	cin>>x;
	for(long long i=-200;i<=200;i++){
		for(long long j=-200;j<=200;j++){
			if(pow(i,5)-pow(j,5)==x){
				cout<<i<<" "<<j;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 4100
/* ABC-132B.c
   Yuta Takayanagi */

#include<stdio.h>
#include<stdlib.h>
int main(void){
    int number, *array, count, i;

    count = 0;

    scanf( "%d" , &number); /* 要素数を入力 */

    array = malloc(sizeof(int) * number); /* p_iを格納する配列を定義 */

    for(i=0; i < number; i++){

        scanf("%d" , array+i); /* 整数を1つずつ格納 */

    }

    for(i=1; i < number-1; i++){

        if((array[i-1] - array[i]) * (array[i] - array[i+1])>0){ /* bがa,b,cの中で2番目に小さい時、(a-b)*(b-c)が同符号 */

            count++; /* 条件を満たしたものをカウント */

        }

    }

    printf( "%d" , count); /* 条件を満たす整数の個数を出力 */

    return 0;
}

Measured memory_bytes: 128
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
if D[0] != 0:
    print(0)
    exit()
D = D[1:]
DD = Counter(D)
if DD[0] != 0:
    print(0)
    exit()
#print(DD)
MOD = 998244353
ans = 1
if len(DD) == 1:
    print(1)
    exit()
for i in range(2,len(DD)+1):
    ans *= pow(DD[i-1],DD[i],MOD)
    ans %= MOD
print(ans)


Measured memory_bytes: 19920
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  string s;
  cin>>s;
  if(s[s.length()-1]=='s'){
    s+="es";
  }else{
    s+="s";
  }
  cout<<s<<endl;
}


Measured memory_bytes: 3624
L=gets.chomp.to_i

#if(L==1)

arr = []

# bone
l = Math.log2(L).to_i
1.upto(l){|i|
	arr << "#{i} #{i+1} 0"
	arr << "#{i} #{i+1} #{2**(i-1)}"
}
rem = L
n = 0 # max l-1
th = 2**l
from = 1
# puts th
while(rem > 1)
	x = rem%2
	# puts "x rem n from #{x} #{rem} #{n} #{from}"
	if(x == 0)
		rem /= 2
		n += 1
		from += 1
		next
	end
	# add 2**n paths
	arr << "#{from} #{l+1} #{th}"
	th += 2**n
	rem /= 2
	n += 1
	from += 1
end

puts "#{l+1} #{arr.size}"
puts arr


Measured memory_bytes: 2044
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
n = int(input())
for i in range(n):
    b = int(input())
    if b in a1:
        a1[a1.index(b)] = 0
    if b in a2:
        a2[a2.index(b)] = 0
    if b in a3:
        a3[a3.index(b)] = 0
if (sum(a1) != 0) and (sum(a2) != 0) and (sum(a3) != 0) and (a1[0] + a2[0] + a3[0] != 0) and (a1[1] + a2[1] + a3[1] != 0) and (a1[2] + a2[2] + a3[2] != 0) and a1[0] + a2[1] + a3[2] != 0 and a1[2] + a2[1] + a3[0] != 0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9272
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;


// Minimum Spanning Tree Kruskal O(E log V)
// 1. init E, V
// 2. kruskal() returns the sum of costs

const int MAX_E = 200000;
const int MAX_V = 100000;

struct edge { ll u, v, cost; };
bool comp(const edge& e1, const edge& e2) {
  return e1.cost < e2.cost; 
}

int par[MAX_V];
int rk[MAX_V];

void init(int n){
  REP(i,n){
    par[i] = i;
    rk[i] = 0;
  }
}

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

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if(x==y) return;
  if(rk[x] < rk[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(rk[x] == rk[y]) rk[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

edge es[MAX_E];
int V, E;

ll kruskal() {
  sort(es, es + E, comp);
  init(V);
  ll res = 0;
  for(int i = 0; i < E; i++) {
    edge e = es[i];
    if (!same(e.u, e.v)) {
      unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}


ll N;
const ll MAX_N = 100000;
ll x[MAX_N], y[MAX_N];

int main(){
  cin >> N;
  REP(i, N) cin >> x[i] >> y[i];
  vpll xs, ys;
  V = N;
  E = 2 * N - 2;
  REP(i, N) {
    xs.pb(pll(x[i], i));
    ys.pb(pll(y[i], i));
  }

  sort(ALL(xs));
  sort(ALL(ys));

  REP(i, N - 1) {
    es[i] = edge{xs[i].S, xs[i + 1].S, xs[i + 1].F - xs[i].F};
    es[N - 1 + i] = edge{ys[i].S, ys[i + 1].S, ys[i + 1].F - ys[i].F};
  }

  cout << kruskal() << endl;

  return 0;
}


Measured memory_bytes: 10596
#include<iostream>
using namespace std;
 
int main(){
  int N;
  int a[201];
  
  cin>>N;
  for(int i=0;i<N;i++)cin>>a[i];
  
  bool flag=true;
  int count=0;
  while(flag){
    for(int i=0;i<N;i++){
      if(a[i]%2!=0){
        flag=false;
      }
    }
    if(flag)count++;
    for(int i=0;i<N;i++){
      a[i]/=2;
    }
  }
  cout<<count;
  return 0;
}

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

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

    if(s[2]==s[3] && s[4]==s[5]) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);

#ifdef BUGGY
	bool DEBUG = 1;
#endif
#ifndef BUGGY
	bool DEBUG = 0;
#endif

ll N, X;
ll A[100005];

int main()
{
	scanf("%lld %lld", &N, &X);

	for (int i = 0; i < N; i++) {
		scanf("%lld", &A[i]);
	}

	sort(A, A + N);

	ll ans = abs(X - A[0]);
	for (int i = 1; i < N; i++) {
		ans = __gcd(ans, A[i] - A[i - 1]);
	}
	cout << ans;

	return 0;
}
/*
	Powered by Buggy Plugin
*/

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  ll a, b;
  cin >> a >> b;
  if (a > 0 && b >= a)
  {
    cout << "Positive" << endl;
  }
  else if (b >= a && b < 0)
  {
    if ((b - a + 1) % 2 == 0)
    {
      cout << "Positive" << endl;
    }
    else
    {
      cout << "Negative" << endl;
    }
  }
  else
  {
    cout << "Zero" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int sum = 0;
        for (int i = 1; i <= n; i++) {
            int sumDigits = 0;
            String[] iStr = Integer.valueOf(i).toString().split("");
            for (int j=0; j < iStr.length; j++) {
                sumDigits += Integer.valueOf(iStr[j]);
            }

            if (a <= sumDigits && sumDigits <= b) {
                sum += i;
            }
        }

        System.out.println(sum);
    }
}


Measured memory_bytes: 34132
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

class City{
public:
  ll normal_fare;
  ll ic_fare;
  ll ic_price;
  City(ll normal_fare,ll ic_fare,ll ic_price){
    this->normal_fare = normal_fare;
    this->ic_fare = ic_fare;
    this->ic_price = ic_price;
  }
};

int main(){
  int total_cities;
  int travel_period;
  while(~scanf("%d %d",&total_cities,&travel_period)){
    vector<int> route;
    for(int day = 0; day < travel_period; day++){
      int city;
      scanf("%d",&city);
      city--;
      route.push_back(city);
    }
    
    vector<City> cities;
    for(int city_i = 0; city_i < total_cities - 1; city_i++){
      ll normal_fare;
      ll ic_fare;
      ll ic_price;
      scanf("%lld %lld %lld",&normal_fare,&ic_fare,&ic_price);
      cities.push_back(City(normal_fare,ic_fare,ic_price));
    }
    ll count[100001] = {};
    for(int route_i = 0; route_i + 1 < route.size(); route_i++){
      int from = route[route_i];
      int to = route[route_i + 1];
      if(from < to){
        for(int i = from; i < to; i++){
          count[i]++;
        }
      }
      else{
        for(int i = to; i < from; i++){
          count[i]++;
        }
      }
    }

    ll res = 0;
    for(int city_i = 0; city_i < total_cities - 1; city_i++){
      res += min(count[city_i] * cities[city_i].normal_fare,
                 count[city_i] * cities[city_i].ic_fare + cities[city_i].ic_price);
    }
    printf("%lld\n",res);
  }
}

Measured memory_bytes: 6324
N, M, X = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
x = [0 for i in range(N+1)]
for i in range(M):
  x[A[i]] = 1
ans1 = 0
for i in range(0,X):
  ans1 += x[i]
ans2 = 0
for i in range(X,N):
  ans2 += x[i]
print(min(ans1, ans2))

Measured memory_bytes: 9104
#include <stdio.h>

int main(void) {
  int a, b, c, k;
  scanf("%d%d%d%d", &a, &b, &c, &k);
  int score = 0;
  if(k <= a) {
    score += k;
    goto result;
  }
  score += a;
  k -= a;
  k -= b;
  if(k <= 0) goto result;
  score -= k;
  
  result:
  printf("%d\n", score);
  
  return 0;
}
    

Measured memory_bytes: 2148
/******************************************
*    AUTHOR:         julianferres         *
******************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl


// dp[0][1] = p[0]
// dp[0][0] = 1-p[0]

// for i in range(1, n):
//     dp[i][0] = dp[i-1][0]*(1-p[i])
//     for j in range(1,n + 1):
//         if j <= i + 1:
//             dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i])

// sum = 0
// for i in range(n + 1):
//     if i > n - i:
//         sum += dp[n-1][i]
// print(sum)
            

            


int main(){
    FIN;
    int n;
    cin >> n;
    vector<double> p(n, 0);
    forn(i, n) cin >> p[i];

    vector<vector<double>> dp(n, vector<double>(n + 1, 0));

    dp[0][1] = p[0];
    dp[0][0] = 1 - p[0];

    forr(i,1,n){
        dp[i][0] = dp[i - 1][0] * (1 - p[i]);
        forr(j, 1, n + 1) if (j <= i + 1)
            dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i]);
    }
    double sum = 0;
    forn(i, n + 1) if (i > n - i) sum += dp[n - 1][i];
    cout << fixed << setprecision(12) << sum << endl;

    return 0;
}



Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 510
using namespace std;

int arr[MAX][MAX];

int main(void)
{
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++)
	{
		for (int j = i + 1; j <= N; j++)
		{
			int cur = 1;
			int ii = i;
			int jj = j;
			while ((ii % 2 == 0) ^ (jj % 2 == 0) == false)
			{
				ii /= 2;
				jj /= 2;
				cur++;
			}
			arr[i][j] = cur;
		}
	}
	for (int i = 1; i <= N; i++)
	{
		for (int j = i + 1; j <= N; j++) cout << arr[i][j] << " ";
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>

using namespace std;

int main(){


	int n;
	cin >> n;
	int max=0,now=0,a=0,p=0;
	for(int i=0;i<n;i++){
		a = now;
		cin >> now;
		if(i == 0)continue;
		if(now <= a)p++;
		if(now > a){
			if(p >= max){
				max = p;
			}
			p = 0;
		}
	}
	if(p >= max){
		max = p;
	}
	cout << max << endl;

	return 0;
}




Measured memory_bytes: 256
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    

    public void solve() throws IOException {
        int q = nextInt(), h = nextInt(), s = nextInt(), d = nextInt();
        long n = nextInt();
        if(h > 2 * q){
            h = 2 * q;
        }
        if(s > 2 * h){
            s = 2 * h;
        }
        if(d > 2 * s){
            d = 2 * s;
        }
        long res = 0;
        if(d <= 2 * s){
            res += n / 2 * d;
            res += (n % 2) * s;
        }else{
            res = n * s;
        }
        out.print(res);
    }


    BufferedReader br;
    StringTokenizer sc;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

    void run() throws IOException {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//            br = new BufferedReader(new FileReader("sum2.in"));
//            out = new PrintWriter(new File("sum2.out"));
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    String nextToken() throws IOException {
        while (sc == null || !sc.hasMoreTokens()) {
            try {
                sc = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return sc.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
}

Measured memory_bytes: 21332
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
  string S;
  cin >> S;
  int cnt_a = 0;
  int cnt_b = 0;
  int cnt_c = 0;
  for (int i = 0; i < S.size(); ++i) {
    if (S[i] == 'a') {
      ++cnt_a;
    } else if (S[i] == 'b') {
      ++cnt_b;
    } else {
      ++cnt_c;
    }
  }
  if (abs(cnt_a - cnt_b) <= 1 && abs(cnt_b - cnt_c) <= 1 && abs(cnt_c - cnt_a) <= 1) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
}

Measured memory_bytes: 3156
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int freq[26];
int main()
{
	fill(freq,freq+26,1000000000);
	int n; cin >> n;
	while(n--)
	{
		string s; cin >> s;
		int local_freq[26]; memset(local_freq,0,sizeof local_freq);
		for(const char& c : s)
			++local_freq[c-'a'];
		for(int c = 0; c < 26; c++)
			freq[c] = min(freq[c],local_freq[c]);
	}
	for(int c = 0; c < 26; c++)
		for(int t = 0; t < freq[c]; t++)
			cout<<(char)(c+'a');

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>

int main(void){
    int i,j,k;
    int N;
    //int M[1000000000];
    long long answer;
    
    scanf("%d",&N);
    
    answer = 0;
    for(i = 1;i < N;i++){
        answer += i;
    }
    
    printf("%ld\n",answer);
    
    return 0;
}


Measured memory_bytes: 128
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int A, B, T;
  cin >> A >> B >> T;
  int ans = T / A * B;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#include <math.h>

int main() {
  int n;
  int in;
  int half_in;
  int num_prime = 0;
  bool isPrime = true;

  scanf("%d", &n);
  if(n < 1 || n > 10000) {
    printf("Error: n is out of range");
    return -1;
  }

  for(int i = 0; i < n; i++) {
    scanf("%d", &in);
    if(in < 2 || in > 10e8) {
      printf("Error: the input is out of range");
      return -1;
    }

    // check if is prime
    if(in == 2 || in == 3) {
      isPrime = true;
    }
    else if(in % 2 == 0) {isPrime = false;}
    else if(in % 2 != 0) {
      for(int i = 3; i <= sqrt(in); i += 2) {
        if(in % i == 0) {
          isPrime = false;
          break;
        }
      }
    }

    if(isPrime == false) {
      isPrime = true;
      continue;
    }
    else if(isPrime == true) {
      num_prime += 1;
      /* printf("is prime\n"); */
    }
  }

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

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

using namespace std;

typedef long long int ll;

ll inf = 1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k, d;
    cin >> n >> k;
    vector<int> a(2e5+2,0);
    int past = k;
    a.at(k) = 1;
    for(int i = 1; i < n; i++)
    {
        cin >> k;
        if(k != past)
        {
            a.at(k) += a.at(past);
            a.at(k) %= inf;
            past = k;

        }
    }
    cout<< a.at(past)<<endl;

    return 0;
}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            Println(3 * Pow(ReadInt(), 2));
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    if(n == 1){
      System.out.println("Hello World");
    }else{
      int a = sc.nextInt();
      int b = sc.nextInt();
      System.out.println(a + b);
    }
  }
}


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

int main() {
	int N, K,r,m;
	cin >> N>> K;
	int l = 1;
	for (int i = 0; i < N; i++) {
		r = l * 2;
		m = l  + K;
		if (m >= r) {
			l  = r;
		}
		else {
			l  = m;
		}
	}
	cout << l ;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long LL;
const int MAXN = 3e5+10;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
int cnt[100];
signed main(){
    LL n; scanf("%lld",&n);
    for(int i=1;i<=n;i++){
        LL x; scanf("%lld",&x);
        for(int j=0;j<=61;j++) cnt[j] += x&(1LL<<j) ? 1:0;
    }
    LL res=0;
    for(int i=0;i<=61;i++)
        res=(res+(((cnt[i]%MOD*((n-cnt[i])%MOD))%MOD)*((1LL<<i)%MOD))%MOD)%MOD;
    printf("%lld\n",res%MOD);
    return 0;
}


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

int ans[200000];
int main()
{
	int n;
	cin >> n;
	for(int i = 0;i<n-1;i++)
	{
		int x;
		cin >> x;
		x--;
		ans[x]++;
	}
	for(int i = 0;i<n;i++)
	{
		cout<<ans[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 4372
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline


def main():
    if input() == "ABC":
        print("ARC")
    else:
        print("ABC")


if __name__ == '__main__':
    main()


Measured memory_bytes: 27136
def main():
    S = input()

    txt = S
    if S[0] != 'A':
        txt = ''.join(('A', txt))
    if S[-1] != 'A':
        txt = ''.join((txt, 'A'))

    if txt[:4] == 'AKIH' and \
            (txt[4:] == 'ABARA' or \
            txt[4:] == 'ABRA' or \
            txt[4:] == 'BARA' or \
            txt[4:] == 'BRA'):
        print('YES')
    else:
        print('NO')

main()


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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

std::vector<std::string> split(std::string str, char del) {
    int first = 0;
    int last = str.find_first_of(del);

    std::vector<std::string> result;

    while(first < str.size()) {
        std::string subStr(str, first, last - first);

        result.push_back(subStr);

        first = last + 1;
        last = str.find_first_of(del, first);

        if(last == std::string::npos) {
            last = str.size();
        }
    }

    return result;
}

int A, B;

int main() {
    cin >> A >> B;
    if(B % A) {
        cout << B - A << "\n";
    } else {
        cout << A + B << "\n";

    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static boolean check(int maskh , int maskw , String arr[] , int K){
		int cnt = 0;
		for(int h = 0 ; h < arr.length ; ++h){
			if((maskh & (1 << h)) != 0){
				continue;
			}
			for(int w = 0 ; w < arr[h].length() ; ++w){
				if(arr[h].charAt(w) == '.'){
					continue;
				}
				if((maskw & (1 << w)) != 0){
					continue;
				}
				++cnt;
			}
		}
		return cnt == K;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int K = sc.nextInt();
		String arr[] = new String[H];
		for(int i = 0 ; i < H ; ++i){
			arr[i] = sc.next();
		}
		int ret = 0;
		for(int i = 0 ; i < (1 << H) ; ++i){
			for(int j = 0 ; j < (1 << W) ; ++j){
				if(check(i , j , arr, K)){
					++ret;
				}
			}
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 35868
#include<iostream>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int A,B,C;
    string result="No";
	cin >> A;
    cin >> B;
    cin >> C;
    if(A<=C && C<=B) result="Yes";
    
	cout << result << "\n";
}

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'


int n;
VP point;

signed main()
{
    cin >> n;
    REP(i, n){
        int x, y;
        cin >> x >> y;
        point.push_back(make_pair(x, y));
    }


    long double sum = 0;
    
    VI v;
    REP(i, n){
        v.push_back(i);
    }

    do {
        FOR(i, 1, n){
            sum += sqrt(pow(point[v[i]].first - point[v[i-1]].first, 2) + pow(point[v[i]].second - point[v[i-1]].second, 2) );
        }
    } while (next_permutation(v.begin(), v.end()));

    int cnt = 1;
    FOR(i,1,n+1){
        cnt *= i;
    }

    cout << fixed << setprecision(10) <<  (long double) (sum) / (long double)(cnt) << endl;
    return 0;
}

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

int main(){
  char w[101];
  int str[26],i,j,k,len;
  scanf("%s",w);
  len = strlen(w);
  for(i=0;i<26;i++){
    str[i]=0;
    for(j=0;j<len;j++){
      if(w[j] == ('a'+i)){
      str[i]++;
      }
    }
  }
  for(i=0;i<26;i++){
    if((str[i] % 2) == 1){
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, intmax_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, intmax_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

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

    size_t N; cin >> N;

    vector<size_t> vec;
    unordered_map<size_t, size_t> cnt;
    for (size_t i = 0; i < N; ++i) {
        size_t a; cin >> a;
        cnt[a]++;
        if (cnt[a] >= 2) {
            vec.emplace_back(a);
            cnt[a] = 0;
        }
    }

    sort(vec.rbegin(), vec.rend());

    cout << (vec.size() >= 2 ? vec[0] * vec[1] : 0) << "\n";

    return 0;
}


Measured memory_bytes: 4388
#include <stdio.h>
int main(void){
    long int n,m,l;
    scanf("%ld%ld%ld",&n,&m,&l);
    //printf("%d %d %d\n",n,m,l);
    long int a[n][m],b[m][l],ans[n][l];
    long int i,j,z;
    for(i=0;i<=n-1;i++){
        for(j=0;j<=m-1;j++){
            scanf("%ld",&a[i][j]); 
            //printf("%d ",a[i][j]);
        }
        //printf("\n");
    }
    for(i=0;i<=m-1;i++){
        for(j=0;j<=l-1;j++){
            scanf("%ld",&b[i][j]); 
            //printf("%d ",b[i][j]);
        }
        //printf("\n");
    }
    for(i=0;i<=n-1;i++){
        for(j=0;j<=l-1;j++){
            ans[i][j]=0;
        }
    }
    //?????????????????????
    for(z=0;z<n;z++){
        for(i=0;i<l;i++){
            for(j=0;j<m;j++){
                ans[z][i]=ans[z][i]+(a[z][j])*(b[j][i]);  
            }
        }
    }
    //
    for(i=0;i<=n-1;i++){
        for(j=0;j<=l-1;j++){
            printf("%ld",ans[i][j]);
            if(j<l-1){
                printf(" ");
            }
        }
        printf("\n"); 
    }
    return 0;
}

Measured memory_bytes: 836
/*------------------------------------
.....Bismillahir Rahmanir Rahim.......
created by muslim.time: 2:24:23 pm....
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld long double
#define   pb push_back
#define   sz(x)  (int)x.size()
#define   ff first
#define   ss second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){ 
    ld a,b,h; 
    cin>>a>>b>>h; 
    cout << ((a+b)/2*h) <<endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

int main()
{
  int x,ans;
  string s;
  vector<int> v;
  cin >> x;
  cin >> s;
  
  ans = 0;
  for (int i = 1; i < x; i++)
  {
    if (s[i-1] != s[i]) ans++;
  }

  cout << ans + 1;
  
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#define LEN 100005

// プロセスを表す構造体
typedef struct pp{
    char name[100];
    int t;
} P;

// Pと同じ構造で長さがLENの構造体Qを作る
P Q[LEN];
int head, tail, n;

// 引数がPとxであり，xをQの末尾につけ，末尾を指すインデックスの数字を一つ増やし，あまりを取る
void enqueue(P x){
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

// Pの構造体でxを参照し，Qの先頭をPのxに加え，先頭の大きさを一つt増やす
P dequeue() {
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b) { return a < b ? a : b; } //最小値を返す

int main(){
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);

    //すべてのプロセスをキューに順番に追加する
    for ( i = 1; i <= n; i++){
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1; tail = n + 1;

    // シミュレーション
    while ( head != tail){
        u = dequeue();
        c = min(q, u.t);  // qまたは必要な時間 u.t だけ処理を行う
        u.t -= c; // 残りの必要時間を計算
        elaps += c;  // 経過時間を加算
        if (u.t > 0) enqueue(u);  // 処理が完了していなければキューに追加
        else{
            printf("%s %d\n", u.name, elaps);  // 名前と経過時間を出力
        }
    }

    return 0;
}


Measured memory_bytes: 11936
n=int(input())
a=list(input().split())
b=list(input().split())
c=list(input().split())

count=0
for i in range(n):
  count=count+int(b[int(a[i])-1])

for i in range(n-1):
  if (int(a[i+1])-int(a[i]))==1:
    count=count+int(c[int(a[i])-1])
  
print(count)

Measured memory_bytes: 38256
import sys
input = sys.stdin.readline
s=input()
month = s[5]+s[6]
day = s[8]+s[9]
if month[0] == '0':
    month = s[6]
if day[0] == '0':
    day = s[9]

if int(month) <= 4:
    print('Heisei')
else:
    print("TBD")

Measured memory_bytes: 3060
a = list(map(int, input()))
b = [a[1], -a[1]]
c = [a[2], -a[2]]
d = [a[3], -a[3]]
flag = 0 
for i in b:
    if(i>=0):
        b_ = '+'
    else: b_ = '-'
    for j in c:
        if(j>=0):
            c_ = '+'
        else: c_ = '-'
        for k in d:
            if(k>=0):
                d_ = '+'
            else: d_ = '-'            
            ans = a[0] + i + j + k
            if ans==7:
                print('{}{}{}{}{}{}{}=7'.format(a[0], b_, a[1], c_, a[2], d_, a[3]))
                flag = 1
                break
        if(flag==1): break
    if(flag==1): break

Measured memory_bytes: 38256
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    tmp0 = input[0].split(" ");
    // tmp1 = input[1].split(" ");

    S = input[0]

    //分割位置導出
    splitIndex = []
    beforeRL = S[0]
    for(var i=1; i < S.length; i++)
    {
      if(beforeRL === 'L' && S[i] === 'R')
      {
        splitIndex.push(i)
      }
      beforeRL = S[i]
    }
    splitIndex.push(S.length)
    // console.log(splitIndex)

    start = 0
    tmpStr = []
    for(var i=0; i < splitIndex.length; i++)
    {
      tmpStr.push(S.substr(start, splitIndex[i] - start)) // start, length
      start = splitIndex[i]
    }
    // console.log(tmpStr)

    var finalR = []
    var finalL = []
    for(var i=0; i < tmpStr.length; i++)
    {
      var Rcnt = tmpStr[i].split('R').length - 1
      var Lcnt = tmpStr[i].split('L').length - 1
      // console.log(`R: ${Rcnt}, L: ${Lcnt}`)
      finalR.push(Math.ceil(Rcnt/2) + Math.floor(Lcnt/2))
      finalL.push(Math.ceil(Lcnt/2) + Math.floor(Rcnt/2))
    }
    // console.log(finalR)
    // console.log(finalL)

    var finalCnt = 0
    for(var i=0; i < S.length-1; i++)
    {
      afterRL = S[i+1]
      // console.log(`S[i] : ${S[i]}, afterRL: ${afterRL}`)
      if(S[i] === 'R' && afterRL === 'L')
      {
        process.stdout.write(finalR[finalCnt] + ' ' + finalL[finalCnt] + ' ');
        i++
        finalCnt++
        if(i === S.length-2)
        {
          process.stdout.write('0');
        }
        continue
      }
      process.stdout.write('0 ');
      if(i === S.length-2)
      {
        process.stdout.write('0');
      }
    }
}
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("RRRLLRLLRRRLLLLL\n");

Measured memory_bytes: 25468
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
using ll = long long;
const int INF=1001001001;
const double PI=3.14159265358979323846; 
 
int main(){
  	int n;
    cin >> n;
	vector<int> b(n);
  rep(i, n-1){
    int s;
    cin >> s;
    b[s-1]++;
  }
  
  rep(i, n) cout << b[i] << endl;
  
  
  return 0;
}


Measured memory_bytes: 4000
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;


#define ll          long long
#define pb          push_back
#define pii         pair<ll ,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define REP(i,n) for (int i = 1; i <= n; i++)
// mp::cpp_int




int solve( ){
  
int n;
cin>>n;
int x;
cin>>x;
int ans=x;
rep(i,1,n)
{
  int x;
  cin>>x;
  ans=__gcd(ans,x);
}
cout<<ans;

return 0;
}
 

int main()
{  int t=1;
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
  
  
  clock_t time_req;

    // Without using pow function
    time_req = clock();
    
//cin>>t;
   while(t--)
     {solve();
     }

         time_req = clock() - time_req;
    //cout << "Processor time taken is "
      //<< (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;


    return 0;
}


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

#define MAX 100002

int n;

vector<int> v;

bool ok(long long int w){
	int ng = w;
	w = v[w];
	for (int i = 0; i < v.size(); i++){
		if (i == ng)continue;
		if (w * 2 >= v[i]){
			w += v[i];
		}
		else{
			return false;
		}
	}
	return true;
}

int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		int a;
		scanf("%d", &a);
		v.push_back(a);
	}
	sort(v.begin(), v.end());
	int mint = 0;
	int maxt = v.size() - 1;
	while (mint + 1 < maxt){
		int mid = (mint + maxt) >> 1;
		if (ok(mid)){
			maxt = mid;
		}
		else{
			mint = mid;
		}
	}
	if (ok(mint)){
		maxt = mint;
	}
	else{
		mint = maxt;
	}
	cout << v.size() - mint << endl;
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(5e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    while(1){
    int n, m, h[1505]{}, w[1505]{}, ans=0;
    cin >> n >> m;
    if(n==0)break;
    map<int, int> hs, ws;
    REP(i,n){
        cin >> h[i+1];
        h[i+1] += h[i];
    }
    REP(i,m){
        cin >> w[i+1];
        w[i+1] += w[i];
    }
    REP(i,n){
        for(int j=i+1;j<=n;j++){
            hs[h[j]-h[i]]++;
        }
    }
    REP(i,m){
        for(int j=i+1;j<=m;j++){
            ws[w[j]-w[i]]++;
        }
    }
    for(auto i : hs){
        if(ws.count(i.first)){
            ans += ws[i.first]*(i.second);
        }
    }
    cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 29892
import sys
input = sys.stdin.readline
def solve():
  R, C, K = map(int, input().split())
  item = [[0]*C for _ in range(R)]
  for i in range(K):
    r,c,v = map(int, input().split())
    item[r-1][c-1] = v
  dp = [[[0]*(C+1) for _ in range(R+1)] for _ in range(4)]
  for i in range(1,R+1):
    for j in range(1,C+1):
      for k in range(4): #横から取らない
        dp[k][i][j] = dp[k][i][j-1]
      #上から取らない
      dp[0][i][j] = max(dp[0][i][j],dp[-1][i-1][j])
      if item[i-1][j-1]>0:
        #上からとる
        dp[1][i][j] = max(dp[1][i][j],dp[-1][i-1][j]+item[i-1][j-1])
        for k in range(1,4): #横から取る
          dp[k][i][j] = max(dp[k][i][j],dp[k-1][i][j-1]+item[i-1][j-1])
      for k in range(1,4):
        dp[k][i][j] = max(dp[k-1][i][j],dp[k][i][j])
  ans = 0
  for k in range(4):
    ans = max(ans,dp[k][-1][-1])
  return ans
print(solve())

Measured memory_bytes: 422972
#include <bits/stdc++.h>
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;


//===

const ll mod = ll(1e9 + 7);



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

	ll N = 50;
	ll r = K % N;
	ll K_m = K - r;
	ll X = K_m / N + N - 1;
	
	Vl a(N,X);
	for (int i = 0; i < r; ++i) {
		a[i] += N + 1;
		for (int j = 0; j < N; ++j) --a[j];
	}


	cout << N << endl;
	for (ll i = 0; i < N - 1; ++i) {
		cout << a[i] << " ";
	}
	cout << a[N - 1] << endl;

	//// test
	//ll K_test = 0;
	//ll a_max;
	//int a_max_idx;
	//while (true) {
	//	a_max = -1;
	//	for (int i = 0; i < N; ++i) {
	//		if (a[i] > a_max) {
	//			a_max = a[i];
	//			a_max_idx = i;
	//		}
	//	}

	//	if (a_max < N) {
	//		break;
	//	}

	//	for (int i = 0; i < N; ++i) {
	//		++a[i];
	//	}

	//	a[a_max_idx] -= N + 1;

	//	++K_test;
	//}

	//cout << K_test << endl;
}


Measured memory_bytes: 256
import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val g = Array(n){ArrayList<Pair<Int,Int>>()}
    for(i in 0 until n - 1){
        val (a,b,c) = readLine()!!.split(" ").map{it.toInt()}
        g[a - 1].add(Pair(b - 1,c))
        g[b - 1].add(Pair(a - 1,c))
    }
    var (Q,k) = readLine()!!.split(" ").map{it.toInt()}
    k--
    val dist = LongArray(n){-1L}
    val q = ArrayDeque<Int>()
    q.addLast(k)
    dist[k] = 0
    while(q.isNotEmpty()){
        val cur = q.first
        q.removeFirst()
        for(i in 0 until g[cur].size){
            if(dist[g[cur][i].first] == -1L){
                dist[g[cur][i].first] = dist[cur] + g[cur][i].second
                q.addLast(g[cur][i].first)
            }
        }
    }
    repeat(Q){
        val (x,y) = readLine()!!.split(" ").map{it.toInt()}
        println(dist[x - 1] + dist[y - 1])
    }
}



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

int main(){
  string s;
  cin >> s;
  bool check[26]={false};
  for(int i=0;i<s.length();i++){
    check[s[i]-'a']=true;
  }
  for(int i=0;i<26;i++){
    if(check[i]==false){
      char ans='a'+i;
      cout<< ans <<endl;
      return 0;
    }
  }
  
  cout<<"None"<<endl;
  
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)

vector<ll> divisor(ll n){
    vector<ll> res;
    for (ll i = 1; i * i <= n; i++){
        if (n % i == 0){
            res.push_back(i);
        }
    }
    return res;
}
int main(){
    ll n, x, y; scll(n);
    vector<ll> div = divisor(n);
    ll ans = 1e18;
    rep(i, 0, div.size()){
        x = div[i], y = n / x;
        ans = min(ans, x + y - 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256