akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i< int (n); i++)
using namespace std;
typedef long long ll;
int main(){
ll sum=0;
int n;
cin >> n;
for(int i=0; i<=n; i++){
    if(i%3==0 || i%5==0) continue;
    else sum+=i;
}
cout << sum << endl;

}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int p;
int main()
{int n;

    cin >> n;
    for (int i = 1; i <= n; ++ i)
    {
        int a;
        cin >> a;
        if (a & 1) p ^= 1;
    }
    if (!p) puts("YES");
    else puts("NO");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

int main(){
    int cnt1 = 0, cnt2 = 0;
    string s, t ,u;
    cin >> s;
    for(int i = 0; i < s.size(); i++) {
        if(i % 2) {
            t.push_back('0');
            u.push_back('1');;
        }
        else{
            t.push_back('1');
            u.push_back('0');
        }
    }
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != t[i]) {
            cnt1++;
        }
        if(s[i] != u[i]) {
            cnt2++;
        }
    }
    cout << min(cnt1,cnt2) << endl;
    
    
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, k;
int GetDigit() {
  int digit=0;
  while(n!=0){
      n /= k;
      digit++;
  }
  return digit;
}


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


  cin >> n >> k;

  cout << GetDigit() << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
int par[100000];
int rank1[100000];
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		rank1[i] = 0;
	}
}
int find1(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find1(par[x]);
	}
}
void unite1(int x, int y) {
	x = find1(x);
	y = find1(y);
	if (x == y)return;
	if (rank1[x] < rank1[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank1[x] == rank1[y])rank1[x]++;
	}
}
bool same(int x, int y) {
	return find1(x) == find1(y);
}
struct edge { int u, v;double cost; };
bool comp(const edge&e1, const edge&e2) {
	return e1.cost > e2.cost;
}
edge es[100000];
int V, E;
double kruskal() {
	sort(es, es + E, comp);
	init(V);
	double res = 0;
	for (int i = 0; i < E; i++) {
		edge e = es[i];
		if (!same(e.u, e.v)) {
			unite1(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}
double dis(pair<double, double>x, pair<double, double> y) {
	return sqrt(pow(x.first - y.first, 2) + pow(x.second - y.second, 2));
}
int main() {
	cin >> V >> E;
	pair<double, double> p[10000];
	double x, y;
	rep(i, V) {
		cin >> x >> y;
		p[i] = { x,y };
	}
	int a, b; double sum = 0;
	rep(i, E) {
		cin >> a >> b; a--; b--;
		es[i] = { a,b,dis(p[a],p[b]) };
		sum += dis(p[a], p[b]);
	}
	cout << fixed<<setprecision(4)<< sum-kruskal() << endl;
	return 0;
}


Measured memory_bytes: 3960
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var M = sc.nextInt();
        var X = sc.nextInt();
        var Y = sc.nextInt();
        var x = sc.ArrayInt(N);
        var y = sc.ArrayInt(M);

        for (int i = X + 1; i <= Y; i++) {
            if (x.Any(j => j >= i) || y.Any(j => j < i)) continue;
            WriteLine("No War");
            return;
        }
        WriteLine("War");

    }
}



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 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 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[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}

Measured memory_bytes: 13268
import sys
n = int(input())
ab = []
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
ab = sorted(ab,key=lambda x:x[1])
limit = 0
for i in range(n):
    limit += ab[i][0]
    if limit > ab[i][1]:
        print("No")
        sys.exit()

print("Yes")

Measured memory_bytes: 39692
INF = 10 ** 100
n = int(raw_input())
ns = []

for i in xrange(n):
    (y, x) = map(int, raw_input().split())
    ns.append((y, x))

ns.sort()

ans = INF

if n == 1:
    ans = 1

for i in xrange(n):
    for j in xrange(i + 1, n):
        dy, dx = ns[j][0] - ns[i][0], ns[j][1] - ns[i][1]

        ps = ns[:]
        st = set(ps)
        cnt = 0

        for p in ps:
            if p not in st:
                continue
            st.remove(p)
            cnt += 1
            y, x = p
            while st:
                ny, nx = y + dy, x + dx
                if (ny, nx) not in st:
                    break
                st.remove((ny, nx))
                y, x = ny, nx
        ans = min(ans, cnt)

print ans


Measured memory_bytes: 2696
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<bitset>
 
#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
  
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};
 
int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int h,w;
    scanf("%d %d", &h, &w);
    int area[h][w], dp[h][w];
    repp(i, h) repp(j, w) scanf("%d", &area[i][j]);
 
    dp[0][0] = area[0][0];
    reppp(j, 1, w) dp[0][j] = dp[0][j-1] + area[0][j];
    reppp(i, 1, h) dp[i][0] = dp[i-1][0] + area[i][0];
    reppp(i, 1, h){
        reppp(j, 1, w){
            dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1] + area[i][j];
        }
    }
 
 
    int ng = min(h,w) + 1, ok = 0;
    while(ng - ok > 1){
        int mid = (ng+ok)/2, flag = 0, sq = 0;
        reppp(i, mid-1, h){
            reppp(j, mid-1, w){
                sq = dp[i][j];
                if(i-mid >= 0) sq -= dp[i-mid][j];
                if(j-mid >= 0) sq -= dp[i][j-mid];
                if(i-mid >= 0 && j-mid>=0) sq += dp[i-mid][j-mid];
                if(sq == 0){
                    flag = 1;
                    break;
                }
            }
            if(flag) break;
        }
 
        if(flag){
            ok = mid;
        }else{
            ng = mid;
        }
    }
 
    printf("%d\n", ok*ok);
 
}


Measured memory_bytes: 18524
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a, b, c; cin >> a >> b >> c;

    if(a < c){
        c -= a; a = 0;
        b -= c;
        if(b < 0) b = 0;
        cout << a << ' ' << b;
    }else{
        cout << a - c << ' ' << b;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 200005;

int n;
int dp[MAXN];
vector<int> gph[MAXN];

pi dfs(int x, int p){
	pi ret(0, x);
	for(auto &i : gph[x]){
		if(i != p){
			auto w = dfs(i, x);
			w.first++;
			ret = max(ret, w);
		}
	}
	return ret;
}

int main(){
	dp[1] = 1;
	cin >> n;
	for(int i=0; i<n-1; i++){
		int s, e; scanf("%d %d",&s,&e);
		gph[s].push_back(e);
		gph[e].push_back(s);
	}
	auto diam = dfs(dfs(1, 0).second, 0).first;
	if(diam % 3 != 1) puts("First");
	else puts("Second");
}


Measured memory_bytes: 26752
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = get_ints

souwa = [0, *A, 0].each_cons(2).map { |from, to| (to - from).abs }.sum

[0, *A, 0].each_cons(3) do |a, b, c|
  puts souwa + (c-a).abs - (a-b).abs - (b-c).abs
end



Measured memory_bytes: 25332
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let (k, x) = read_touple::<usize>();
    let ans = if 500 * k >= x {
      "Yes"
    } else {
      "No"
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void ABC089D();

#if 1
int main()
{
	ABC089D();
	fflush(stdout);
	return 0;
}
#endif

static void ABC089D()
{
	int H, W, D;
	getint(H, W, D);

	std::vector<std::pair<int, int>> valPos(H * W + 1, std::pair<int, int>(0, 0));

	for (int h = 0; h < H; h++) {
		for (int w = 0; w < W; w++) {
			int val;
			getint(val);
			valPos[val].first = h + 1;
			valPos[val].second = w + 1;
		}
	}

	int gridCount = H * W;
	std::vector<std::vector<int>> cost(D + 1, std::vector<int>((gridCount / D) + 1, 0));
	for (int i = 1; i <= D; i++) {
		int mul = 1;
		int index = i + D;
		while (index <= gridCount) {
			int tmpCost = std::abs(valPos[index].first - valPos[index - D].first)
				+ std::abs(valPos[index].second - valPos[index - D].second);
			cost[i][mul] = tmpCost + cost[i][mul - 1];
			mul++;
			index = i + (D * mul);
		}
	}

	int Q;
	getint(Q);
	std::vector<LLONG> costs(Q, 0);
	for (int q = 0; q < Q; q++) {
		int now, end;
		getint(now, end);
		
		int firstIdx = end % D;
		if (!firstIdx) {
			firstIdx = D;
		}
		costs[q] = cost[firstIdx][(end - firstIdx) / D] - cost[firstIdx][(now - firstIdx) / D];
	}
	for (int i = 0; i < Q; i++) {
		printf("%lld\n", costs[i]);
	}
}


Measured memory_bytes: 6784
/// >>In The Name Of God
/// >>ALIREZANA

#include <bits/stdc++.h>
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define smin(x,y) (x) = min(x,y)
#define smax(x,y) (x) = max(x,y)
#define all(x) (x).begin(),(x).end()
#define _ ios_base::sync_with_stdio(0)\
                ,cin.tie(0),cout.tie(0);

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main()
{_
    int n;
    cin >> n;
    vector<pair<string, int> > v;

    for(int i = 0; i < n; i++)
    {
        string s; int p;
        cin >> s >> p;
        v.pb({s, p*1000+i+1});
    }
    sort(all(v), [&](pair<string, int>  a, pair<string, int>  b){
         return a.fr == b.fr ? a.sc > b.sc : a.fr < b.fr;});
    for(int i = 0; i < n; i++)
        cout << (v[i].sc%1000) << endl;
    return 0;
}


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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] p = new int[n];
		int count = 0;
		
		for(int i = 0; i < n; i++) {
			p[i] = stdIn.nextInt();
		}
		
		for(int i = 1; i < n-1; i++) {
			if((p[i] > p[i-1] && p[i] < p[i+1])||(p[i] < p[i-1] && p[i] > p[i+1])) {
				count++;
			}
		}
		System.out.println(count);

	}

}

Measured memory_bytes: 21844
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;

Int GCD(Int a, Int b){
if(b==0) return a;
if(a < b) return GCD(b, a);
unsigned r;
while ((r=a%b)) {
a = b;
b = r;
}
return b;
}

int main() {
    int H,W,h,w, ans;
    cin >> H >> W >> h >> w;
    ans = H*W - (h*W + w*H - h*w);

    cout << ans;
    return 0;
}

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

#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int maxn = 2e5 + 4;
int b[maxn];
pii a[maxn];

int main () {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i].F;
		a[i].S = i;
	}
	sort (a + 1, a + n + 1);
	for (int i = 1; i <= n; i++) {
		if (i <= n / 2) {
			b[a[i].S] = a[n / 2 + 1].F;
		}
		else {
			b[a[i].S] = a[n / 2 + 0].F;
		}
	}
	for (int i = 1; i <= n; i++)
		cout << b[i] << " ";
}


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

int main()
{
  int N, Y, k;

  cin >> N >> Y;
  for (int i = 0; i <= N; i++)
  {
    for (int j = 0; j <= N; j++)
    {
      k = N - i - j;
      if (k < 0)
        break;
      if (i * 10000 + j * 5000 + k * 1000 == Y)
      {
        cout << i << " " << j << " " << k << endl;
        return (0);
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    
    int a = N/100;
    int c = N%10;
    int b = (N-100*a-c)/10;
    
    if(a==7||b==7||c==7){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}



Measured memory_bytes: 35748
<?php
/* a op b */
while(fscanf(STDIN,"%d %s %d", $a, $op, $b)){
    if($op == "?"){
        return 1;
    }elseif($op == "+"){
        echo $a + $b;
    }elseif($op == "-"){
        echo $a - $b;
    }elseif($op == "*"){
        echo $a * $b;
    }elseif($op == "/"){
        echo floor($a / $b);
    }
    echo PHP_EOL;
}
?>

Measured memory_bytes: 14928
import sys
input = lambda: sys.stdin.readline().rstrip()

n = int(input())
h = list(map(int, input().split()))
inf = 1001001001
dp = [inf for _ in range(n + 5)]
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, n):
    dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                dp[i - 1] + abs(h[i] - h[i - 1]))
print(dp[n-1])


Measured memory_bytes: 20520
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
#define FOR(i, s, n) for(int i=s; i<n; i++)

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> mat;

int main(){
    int N; cin >> N;
    if (N >= 1000){
        cout << "ABD" << endl;
    }else{
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


int main()
{
    fastio
    int n, r;
    cin>>n>>r;
    if(n>=10)
    {
        cout<<r<<endl;
    }
    else
    {
        cout<<r + 100*(10-n)<<endl;
    }
}


Measured memory_bytes: 256
solve3 list = loop list
  where
    loop [] = return ()
    loop ([n]:dataSet:dataSets) = do
      let m = (sum dataSet) / n :: Double
          sigma = sqrt . (/n) .  foldr ((+) . (\s -> (s-m)**2)) 0 $ dataSet

      print sigma
      loop dataSets

main = do
  dataSet <- fmap (init . map (map read) . map words . lines) getContents :: IO [[Double]]
  solve3 dataSet


Measured memory_bytes: 5016
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func digits(n int) int {
	s := strconv.Itoa(n)
	return len(strings.Split(s, ""))
}

func isOdd(n int) bool {
	if n%2 == 1 {
		return true
	}
	return false
}

func main() {
	var n int
	fmt.Scan(&n)

	var result int
	for ; 0 < n; n-- {
		if isOdd(digits(n)) {
			result++
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 5504
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

struct Monoid {
  int64_t val;
  Monoid(){};
  Monoid(int64_t v) : val(v){};
  static Monoid ident() { return Monoid(0); }
  static Monoid multiply(Monoid l, Monoid r) { return Monoid(l.val + r.val); }
};

template <typename M>
struct SegmentTree {
  int n;
  M e;
  vector<M> dat;
  SegmentTree(int N, vector<M> a) {
    assert(N == (int)a.size());
    n = 1;
    e = M::ident();
    while (n < N) {
      n *= 2;
    }
    dat.resize(n * 2 - 1, e);
    rep(i, N) dat[i + n - 1] = a[i];
    for (int i = n - 2; i >= 0; i--) {
      dat[i] = M::multiply(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }
  M get(int i) { return dat[i + n - 1]; }
  void set(int i, M m) {
    auto k = i + n - 1;
    dat[k] = m;
    while (k) {
      k = (k - 1) / 2;
      dat[k] = M::multiply(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  M query(int ql, int qr) { return query(ql, qr, 0, 0, n); }
  M query(int ql, int qr, int i, int il, int ir) {
    if (ql <= il and ir <= qr) {
      return dat[i];
    } else if (qr <= il or ir <= ql) {
      return e;
    } else {
      auto m = (il + ir) / 2;
      return M::multiply(query(ql, qr, i * 2 + 1, il, m),
                         query(ql, qr, i * 2 + 2, m, ir));
    }
  }
};

int main() {

  int n, q;
  scanf("%d %d", &n, &q);
  vector<Monoid> a;
  SegmentTree<Monoid> seg(n, vector<Monoid>(n, Monoid(0)));
  while (q--) {
    int t;
    scanf("%d", &t);
    if (t == 0) {
      int i, x;
      scanf("%d %d", &i, &x);
      seg.set(i - 1, Monoid(seg.get(i - 1).val + x));
    } else {
      int l, r;
      scanf("%d %d", &l, &r);
      printf("%ld\n", seg.query(l - 1, r).val);
    }
  }

  return 0;
}



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

struct data {
  long long h, a, d, s;
  bool operator<(const data &r) const {
    long long nowl = h * r.a, nowr = r.h * a;
    if(nowl != nowr) return nowl < nowr;
    return s > r.s;
  }
};

long long n;
data me;
vector<data> v;

long long solve();

int main() {
  cin >> n >> me.h >> me.a >> me.d >> me.s;
  v.resize(n);
  for(int i = 0; i < n; ++i) {
    cin >> v[i].h >> v[i].a >> v[i].d >> v[i].s;
    v[i].a = max(0LL, v[i].a - me.d);
    v[i].d = max(0LL, me.a - v[i].d);
    if(v[i].a == v[i].d && v[i].a == 0) {
      v.pop_back();
      --n;
      --i;
      continue;
    }
    if(v[i].d == 0) {
      cout << -1 << endl;
      return 0;
    }
    v[i].h = (v[i].h + v[i].d - 1) / v[i].d;
  }
  sort(v.begin(), v.end());
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long res = 0, turn = 0;
  for(int i = 0; i < n; ++i) {
    turn += v[i].h - (me.s > v[i].s);
    res += v[i].a * turn;
    if(me.s > v[i].s) ++turn;
    if(res >= me.h) return -1;
  }
  return res;
}


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

int main()
{
    long long n, w, i, j;
    cin >> n >> w;
    long long wts[n][2];

    for(i = 0; i < n; ++i)
        cin >> wts[i][0] >> wts[i][1];

    vector<vector<long long>> dp(n, vector<long long>(w + 1));

    for(i = 0; i <= w; ++i)
        dp[0][i] = (wts[0][0] <= i) ? wts[0][1] : 0;
    for(i = 0; i < n; ++i)
        dp[i][0] = 0;

    for(i = 1; i < n; ++i) {
        for(j = 1; j <= w; ++j) {
            dp[i][j] = (wts[i][0] <= j) ? max(dp[i - 1][j], wts[i][1] + dp[i - 1][j - wts[i][0]]) : dp[i - 1][j];
        }
    }
    cout << dp[n - 1][w] << "\n";
    return 0;
}

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

#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define pb push_back
#define fi first
#define se second
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	ll n;
	cin >> n;

	bool found = false;
	ll ans = 1e18;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			ans = MIN(ans,(i - 1 + n / i - 1));
			found = true;	
		}
	}
	
	if (found)
		cout << ans << '\n';
	else
		cout << n - 1 << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int maxn=3001000;
const int mod=1e9+7;
typedef long long ll;
using namespace std;

ll qpow(ll x,ll y)
{
    ll sum=1;
    while(y)
    {
        if(y&1)
            sum=(sum*x)%mod;
        x=x*x%mod;
        y/=2;
    }
    return sum;
}

int main()
{
    double a,b,x;
    cin>>a>>b>>x;
    double sum=a*a*b;
    double shengyu=sum-x;
    if(shengyu<=sum/2.0)
        printf("%.6f",atan(shengyu*2.0/(a*a*a))/3.1415926*180.0);
    else{
        printf("%.6f",90.0-atan(x*2.0/(a*b*b))/3.1415926*180.0);
    }
}


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

class Program
{
    static void Main()
    {
        var imput = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        Console.WriteLine(Enumerable.Repeat(0, imput[0]).Select(_ => Console.ReadLine().Split(' ').Select(int.Parse).ToArray()).Where(p => p[1] <= imput[1]).Select(p => p[0]).OrderBy(p => p).Select(p=>(int?)p).FirstOrDefault()?.ToString() ?? "TLE");
    }
}

Measured memory_bytes: 13524
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)



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

    cout << 6-(A+B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second
#define Mat vector<vector<ll>>
#define Arr vector<ll>
#define Matd vector<vector<ld>>
#define Arrd vector<ld>

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b;
    cin >> a >> b;
    fori(i, b - a + 1, b + a) cout << i<< ' ';
    return 0;
}

Measured memory_bytes: 256
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   ll w,s;
   cin>>s>>w;
   if(w>=s)
   cout<<"unsafe";
   else
   cout<<"safe";
}




Measured memory_bytes: 3612
n, m = map(int, input().split())
c = [list(map(int, input().split())) + [i] for i in range(m)]
d = c[:]
d.sort(key = lambda val: val[1])

k = [0] * 100010
ans = []
for i in d:
    ans.append([i[2], i[0], k[i[0]] + 1])
    k[i[0]] += 1
ans.sort()
for i in ans:
    print(str(i[1]).zfill(6) + str(i[2]).zfill(6))

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

using namespace std;

#define pb push_back
#define NL endl
#define pi 2.0*acos(0.0)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

ll n, k, arr[100005], dp[100005];

ll calculateJump(ll pos) {
    if(pos >= n) return 0;
    if (dp[pos] != -1) return dp[pos];
    ll minm = abs(arr[pos] - arr[pos + 1]) + calculateJump(pos + 1);
    for (ll i = 2; i <= k; i++) {
        if (i + pos <= n) minm = min(minm, abs(arr[pos] - arr[pos + i]) + calculateJump(pos + i));
    }
    dp[pos] = minm;
    return dp[pos];
}

int main() {
    cin >> n >> k;
    for (ll i = 1; i <= n; i++) {
        cin >> arr[i];
    }
    fill(dp, dp + n + 1, -1);
    cout << calculateJump(1) << endl;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  int K;
  cin >> K;
  map<string,bool> mp;
  vector<string> list;
  REP(i,s.size()){
    FOR(j,1,K+1){
      string tmp = s.substr(i,j);
      if(!mp[tmp]){
        list.emplace_back(tmp);
        mp[tmp]=true;
      }
    }
  }
  sort(ALL(list));
  
  cout << list[K-1] << endl;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int n,x;
	cin >> n >>x;
	int now=0,ans=0;
	rep(i,n)
	{
		int foo;
		cin >> foo;
		
		if(now<=x)ans++;
		now+=foo;
	}
	if(now<=x)ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
 * Author: Anmol Choudhary
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
void solve()
{
    set<int>s;
    rep0(i,3){
        int x;
        cin>>x;
        s.in(x);
    }
    if(s.si==2) cout<<"Yes";
    else cout<<"No";
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 256
n = input()
a = [0] + map(int, raw_input().split()) + [0]
l = sum([abs(a[i+1]-a[i]) for i in range(n+1)])
for i in range(1,n+1):
    print(l + abs(a[i+1]-a[i-1]) - abs(a[i]-a[i-1]) - abs(a[i+1]-a[i]))

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

void Main(){
	int n, k;
	cin >> n >> k;
	vi x(n);
	rep(i,n) cin >> x[i];

	ll ans = LLONG_MAX;
  
	rep(i, n-k+1) {
		ll temp = abs(x[i]) + abs(x[i+k-1] - x[i]);
		ll temp2 = abs(x[i+k-1]) + abs(x[i+k-1] - x[i]);
		ans = min({ans, temp, temp2});
	}
  
	cout << ans << endl;
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...) \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
   public:
    void solve() {
        int n, k;
        cin >> n >> k;
        vector<double> a(n);
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            a[i] = 1 + a[i];
        }
        double sum = 0, ans;
        for (int i = 0; i < k; ++i) {
            sum += a[i];
        }
        ans = sum;
        for (int i = k; i < n; ++i) {
            sum += a[i];
            sum -= a[i - k];
            ans = max(sum, ans);
        }
        printf("%.10f\n", ans / 2.0);
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
int main()
{
    ll n,k;
    while(cin>>n>>k)
    {
       ll mid = 0;
       ll res = 0;
       for(int i = 1; i <= n ; i++)
       {
           if(i%k == 0)
            res++;

           if(k%2 == 0&&k/2 == i%k)
            mid++;
        }
        cout<<mid*mid*mid + res*res*res<<endl;
    }

}
















Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long i64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 1e6+5, P = 1e9+7;
int n, ans; i64 fac[N], ifac[N], f[N];
i64 inv(int i) { return i == 1?1:P-(P/i)*inv(P%i)%P; }
i64 C(int n, int m) { return 0 <= m&&m <= n?fac[n]*ifac[m]%P*ifac[n-m]%P:0; }
int main()
{
    n = read(), fac[0] = 1;
    for(int i = 1; i <= n; ++i) fac[i] = fac[i-1]*i%P;
    ifac[n] = inv(fac[n]); for(int i = n; i; --i) ifac[i-1] = ifac[i]*i%P;
    for(int i = 1; i < n; ++i) f[i] = C(i-1, n-i-1)*fac[i]%P*fac[n-1-i]%P;
    for(int i = n/2; i < n; ++i) ans = (ans+(f[i]-f[i-1]+P)%P*i%P)%P;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 23552
#include <cstdio>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using Edges = std::vector<int>;

class Node {
 public:
  explicit Node(int id): id_(id) {}
  void addEdge(int edge) {
    edges_.push_back(edge);
  }
  const Edges& edges() const {return edges_;}
  int id() const {return id_;}
 private:
  int id_;
  Edges edges_;
};

class Graph {
  using GraphIndices = std::unordered_map<int, Node*>;
 public:
  Graph() = default;

  Node* find(int id) {
    return graph_.find(id)->second;
  }

  size_t size() const {
    return graph_.size();
  }

  GraphIndices::iterator begin() {return graph_.begin();}
  GraphIndices::iterator end() {return graph_.end();}
  
  void addNode(int id, int to) {
    auto from = graph_.find(id);
    Node* node = nullptr;
    if (graph_.end() == from) {
      node = new Node(id);
      graph_.insert({id, node});
    } else {
      node = from->second;
    }
    node->addEdge(to);
    if (id == 1) {
      start_ = node;
    }
    
    auto toNode = graph_.find(to);
    if (graph_.end() == toNode) {
      node = new Node(to);
      graph_.insert({to, node});
    } else {
      node = toNode->second;
    }
    node->addEdge(id);
  }
  
  Node* start() {return start_;}
 private:
  Node* start_;
  GraphIndices graph_;
};

using VisitedSet = std::unordered_set<int>;

void walk(int* route_count, Node* node, Graph* graph, VisitedSet* visited_set) {
  visited_set->insert(node->id());
  for (const auto &e: node->edges()) {
    if (visited_set->count(e) > 0) {
      continue;
    }
    auto copy = *visited_set;
    walk(route_count, graph->find(e), graph, &copy);
  }

  if (visited_set->size() == graph->size()) {
    (*route_count)++;
  }
}

int main() {
  int edgeCount = 0, vertCount = 0;
  scanf("%d %d", &vertCount, &edgeCount);
  Graph graph;

  for (int i = 0; i < edgeCount; i++) {
    int vertId = 0, toVertId = 0;
    scanf("%d %d", &vertId, &toVertId);
    graph.addNode(vertId, toVertId);
  }

  int find_routes = 0;
  VisitedSet visited_set;
  walk(&find_routes, graph.start(), &graph, &visited_set);
  printf("%d\n", find_routes);
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <regex>

#define M_PI       3.14159265358979323846

using namespace std;

//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(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

char str[300005];
int cnt[300005];

int main() {
	int n, ret = 10000000;
	scanf("%d", &n);
	scanf("%s", str);
	REP(i, n) cnt[i + 1] = cnt[i] + (str[i] == 'W');
	REP(i, n) {
		ret = min(ret, cnt[i] + n - i - 1 - (cnt[n] - cnt[i + 1]));
	}
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 1792
unittest
{
	assert( [ "3 2", "2 1" ].parse.expand.solve == 1 );
	assert( [ "5 5", "2 3" ].parse.expand.solve == 6 );
	assert( [ "2 4", "2 4" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto HW = input.front.split.to!( long[] );
	input.popFront;
	auto hw = input.front.split.to!( long[] );
	return tuple( HW[ 0 ], HW[ 1 ], hw[ 0 ], hw[ 1 ] );
}

auto solve( long H, long W, long h, long w )
{
	return ( H - h ) * ( W - w );
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


i = 0
n = int(input())
if n == 1:
    print(0)
else:
    arr = factorization(n)
    for a, b in arr:
        i += int((-1 + (1 + 8 * b)**(1 / 2)) // 2)
    print(i)


Measured memory_bytes: 9480
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 2*1e5+5 ;
const long long MOD = 1e9 + 7;
const long long inf = 1e18;
 
using namespace std;
 

// ll modpow(ll x,ll n){
//     ll res=1;
//     while(n>0){
//         if(n&1) res=res*x%MOD;
//         x=x*x%MOD;
//         n>>=1;
//     }
//     return res;
// }
 
// ll modFact(ll n, ll p) 
// { 
//     if (n >= p) 
//         return 0; 
  
//     ll result = 1; 
//     for (ll i = 1; i <= n; i++) 
//         result = (result * i) % p; 
  
//     return result;  
// } 
 
// bool isPrime(int x)
// {
//     if(x%2==0)
//         return 0;
//     for(int i=3;i<=sqrt(x);i+=2)
//     {
//         if(x%i==0)
//             return 0;
//     }
//     return 1;
// }
 
// ll binomialCoeff(ll n, ll k) 
// { 
// 	ll C[n + 1][k + 1]; 
// 	ll i, j; 


// 	for (i = 0; i <= n; i++) 
// 	{ 
// 		for (j = 0; j <= min(i, k); j++) 
// 		{ 
			
// 			if (j == 0 || j == i) 
// 				C[i][j] = 1; 

// 			else
// 				C[i][j] = (C[i - 1][j - 1] + 
// 										C[i - 1][j])%MOD; 
// 		} 
// 	} 

// 	return C[n][k]; 
// }
// bool compare(const string &a , const string&b){
	
// }
int a[N] ;
void solve()
{
	int a , b , c ; 
	cin>>a>>b>>c ;
	cout<<b*(c/a)<<endl;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    // cin>>t;b
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = (1 << 18) + 10;
ll A[MAX_N];
ll ans[MAX_N];
vector< pair<ll, int> > dp[MAX_N];

int main2() {

  REP(i, MAX_N) dp[i].clear();
  CLR(ans, 0);

  int N = nextInt();
  int T = 1 << N;
  REP(i, T) A[i] = nextInt();

  REP(i, T) dp[i].push_back( {A[i], i} );

  for (int i = 1; i < T; i++) {
    // cout << i << "->";
    for (int n = 0; n < N; n++) if (i >> n & 1) {
      int u = i ^ (1 << n);
      // cout << u << " ";
      for (auto p : dp[u]) {
        dp[i].push_back(p);
      }
    }
    // cout << endl;
  
    sort(ALL(dp[i]));
    reverse(ALL(dp[i]));
    unique(ALL(dp[i]));
    if (dp[i].size() > 2) { dp[i].erase(dp[i].begin() + 2, dp[i].end()); }
    // cout << i << ":"; pv(ALL(dp[i]));
    ans[i] = (dp[i][0].first + dp[i][1].first);
  }
  // pv(ans, ans + T);

  for (int k = 1; k < T; k++) {
    chmax(ans[k], ans[k-1]);
    printf("%lld\n", ans[k]);
  }
  return 0;
}

int main() {

  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

void yes(void) {
	puts("Yes");
	exit(0);
}

int main(void) {
	int A[3][3];
	int N;
	int b[16];
	char ana[3][3] = {{0}};
	int i, j, k;
	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) {
			if (scanf("%d", &A[i][j]) != 1) return 1;
		}
	}
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &b[i]) != 1) return 1;
		for (j = 0; j < 3; j++) {
			for (k = 0; k < 3; k++) {
				if (A[j][k] == b[i]) ana[j][k] = 1;
			}
		}
	}

	if (ana[0][0] && ana[0][1] && ana[0][2]) yes();
	if (ana[1][0] && ana[1][1] && ana[1][2]) yes();
	if (ana[2][0] && ana[2][1] && ana[2][2]) yes();

	if (ana[0][0] && ana[1][0] && ana[2][0]) yes();
	if (ana[0][1] && ana[1][1] && ana[2][1]) yes();
	if (ana[0][2] && ana[1][2] && ana[2][2]) yes();

	if (ana[0][0] && ana[1][1] && ana[2][2]) yes();
	if (ana[0][2] && ana[1][1] && ana[2][0]) yes();

	puts("No");
	return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.text.*;
import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t =1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000");
        long max = 1000000000000000l, min = -10000000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        int modPow(int x, int y) {
            int res = 1;
            while (y > 0) {
                if (y % 2 != 0)
                    res *= x;
                x = x * x;
                y = y >> 1;
            }
            return res;
        }

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

        final int maxn = 1000005;

        void solve() {
           String s=sc.sn();
           if(s.contains("A")&& s.contains("B"))
               out.println("Yes");
           else
               out.println("No");
        }
    }
}

Measured memory_bytes: 21716
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	r := sc.nextInt()
	fmt.Println(3 * pow(r, 2))
}


Measured memory_bytes: 640