akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

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

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

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

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

    int r, g, b, n;
    cin >> r >> g >> b >> n;

    int ans = 0;
    rep(i, n + 1){
        rep(j, n + 1){
            int nokori = n - r * i - g * j;
            if(nokori >= 0 && nokori % b == 0){
                ++ans;
            }
        }
    }

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 256
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) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

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()
	A, B, T := sc.nextInt(), sc.nextInt(), sc.nextInt()
	fmt.Println(B * (T / A))
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

public class Main {

    public static void main(String[] args) throws IOException {

        DecimalFormat df1 = new DecimalFormat("0.00000");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        String[] strArray = input.split(" ");

        int a = Integer.parseInt(strArray[0]);
        int b = Integer.parseInt(strArray[1]);

        int d = a / b;
        int r = a % b;
        String f = df1.format((double) a / b);

        System.out.println(d + " " + r + " " + f);
    }
}

Measured memory_bytes: 25972
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    X = II()

    mon = 100
    for i in range(1, 4000):
        mon = mon * 101 // 100
        if mon >= X:
            print(i)
            return

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9232
def main():
    A = int(input())
    B = int(input())
    if A > B:
        A, B = B, A

    if A == 1 and B == 2:
        print(3)
    elif A == 1 and B == 3:
        print(2)
    else:
        print(1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
eval'K,X,Y='+`dd`.split*?,;x,y,*s=X.abs,Y.abs;d=x+y;x,y=y,x if f=x>y;K%2-d%2<0&&(p -1;exit);n=(d-1)/K+1;n+=d<K ? 1:(d-n*K)%2;a=n<2 ?x:(d-n*K)/2;b=K-a.abs;d%2-d/K>0&&(s=[[0,-K]];a=b=(d-K)/2);n.times{s<<[a,b];t=[x-a,K].min;a+=t;b+=K-t};p s.size;s.each{|a,b|f&&(a,b=b,a);p a*(X<=>0.1),b*(Y<=>0.1)}

Measured memory_bytes: 22144
#include <bits/stdc++.h>
#define INF 9999

using namespace std;

int n, k, pre, ans;
vector<vector<int>> G(2002);
int d[2002];

void search(int p, int s, int sum){
	if(sum > k/2)pre++;
	d[s] = sum;
	for(int i = 0; i < (int)G[s].size(); i++)if(G[s][i] != p)search(s, G[s][i], sum+1);
}
void search2(int p, int s, int sum){
	if(min(d[s], sum) > k/2)pre++;
	for(int i = 0; i < (int)G[s].size(); i++)if(G[s][i] != p)search2(s, G[s][i], sum+1);
}


int main(){
	ans = INF;
	cin >> n >> k;
	for(int i = 0; i < n-1; i++){
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	if(k%2==0){
		for(int i = 0; i < n; i++){
			pre = 0;
			search(INF, i, 0);
			ans = min(ans, pre);
		}
	}
	else{
		for(int i = 0; i < n; i++){
			fill(d, d+n, 0);
			search(INF, i, 0);
			for(int j = 0; j < (int)G[i].size(); j++){
				if(i < G[i][j])continue;
				pre = 0;
				search2(INF, G[i][j], 0);
				ans = min(ans, pre);
			}
		}
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
     int a,b,c,d;
     cin>>a>>b>>c>>d;
     int x=a+b;
     int y=c+d;
    if(x>y)
        cout<<"Left"<<endl;
    else if(y>x)
        cout<<"Right"<<endl;
    else
        cout<<"Balanced"<<endl;

    return 0;
}


Measured memory_bytes: 3660
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""
n = onem()

co = 0

for i in range(1,n):
    po = n // i
    co += po
    if i * po == n:
        co -= 1
print(co)

Measured memory_bytes: 83000
s = input()
n = len(s) - 1

ans = 0
if n == 0:
    ans = int(s)
else:
    for i in range(2 ** n):
        calc = [0 for i in range(n)]
        for j in range(n):
            if ((i >> j) & 1):
                calc[- 1 - j] = 1
        str_num = s[0]
        for k in range(n):
            if calc[k] == 0:
                str_num += s[k+1]
            elif calc[k] == 1:
                ans += int(str_num)
                str_num = s[k+1]
            if k == n-1:
                ans += int(str_num)

print(ans)

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

int A, B, C;

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> A >> B >> C;
    rep(k, B) {
        if ((k*A-C)%B==0) {
            cout << "YES" << endl;
            exit(0);
        }
    }
    cout << "NO" << endl;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        int n = reader.nextInt();
        int k = reader.nextInt()-1;
        int[] h = new int[n];
        for (int i = 0; i < n; ++i)
            h[i] = reader.nextInt();
        Arrays.sort(h);
        int res = Integer.MAX_VALUE;
        for (int i = 0; i < n - k; ++i)
            if (Math.abs(h[i] - h[i + k]) < res)
                res = Math.abs(h[i] - h[i + k]);
        System.out.println(res);
        reader.close();
    }
}

Measured memory_bytes: 50724
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

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

    string s;
    for(int i=0;N;i++){
        if((abs(N)>>i)&1){
            if(i%2){
                N+=(1LL<<i);
            }
            else{
                N-=(1LL<<i);
            }
            s.insert(s.begin(),'1');
        }
        else{
            s.insert(s.begin(),'0');
        }
    }
    if(s==""){
        cout<<"0"<<endl;
    }
    else{
        cout<<s<<endl;
    }
}

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

int main(){
  int H,W,D;
  cin>>H>>W>>D;
  vector<pair<int,int>> p(H*W+1);
  p[0]=make_pair(0,0);
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      int A;
      cin>>A;
      p[A]=make_pair(i,j);
    }
  }

  //余りがiの累積和をq[i]に入れる
  //q[i][j]=(iからi+j*Dまでの移動コスト)
  vector<vector<int>> q(D+1,vector<int>());
  for(int i=1;i<=D;++i){
    int j=i+D;
    int sum=0;
    q[i].push_back(0);
    while(j<=H*W){
      sum += abs(p[j].first-p[j-D].first)+abs(p[j].second-p[j-D].second);
      q[i].push_back(sum);
      j += D;
    }
  }

  int Q;
  cin>>Q;

  for(int i=0;i<Q;++i){
    int L,R;
    cin>>L>>R;
    if(L%D==0){
      int s=L/D,t=R/D;
      cout<<q[D][t-1]-q[D][s-1]<<endl;
    }
    else{
      int s=L/D,t=R/D,u=L%D;
      cout<<q[u][t]-q[u][s]<<endl;
    }
  }
}


Measured memory_bytes: 6016
from collections import deque
n = int(input())
A = deque(map(int, input().split()))

next_ = 1
cnt = 0
while len(A) > 0:
  i = A.popleft()
  if i == next_:
    next_ += 1
  else:
    cnt += 1
if cnt == n:
  cnt = -1
print(cnt)

Measured memory_bytes: 25244
n, m = map(int, input().split())

g = [[0 for j in range(n)] for i in range(n)]

for i in range(m):
    u, v, w = map(int, input().split())
    g[u - 1][v - 1] = g[v - 1][u - 1] = w

e = [sum(g[i][j] for i in range(n) if S >> i & 1 for j in range(i + 1, n) if S >> j & 1) for S in range(1 << n)]

dp = [[-10 ** 9 for j in range(n)] for i in range(1 <<  n)]

for i in range(1 << n):
    for j in range(n):
        if i >> j & 1:
            if not j:
                dp[i][j] = e[i]
            else:
                for k in range(n):
                    if  j != k and (i >> k & 1) and g[k][j]:
                        dp[i][j] = max(dp[i][j], dp[i ^ (1 << j)][k] + g[k][j]) 
                s = i ^ (1 << j)
                k = s
                while k:
                    dp[i][j] = max(dp[i][j], dp[i ^ k][j] + e[k | 1 << j])
                    k = (k - 1) & s 

print(e[(1 << n) - 1] - dp[(1 << n) - 1][n - 1])

Measured memory_bytes: 68336
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ll long long
#define f(i) return cout<<i<<"\n",0;
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define lp(i,a,b) for (int i=(a);i<=(int)(b);++i)
#define lp2(i,a,b) for (int i=(a);i>=(b);--i)
#define clr(c,x) memset(c,x,sizeof(c))
#define allr(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end()
const int N=2e5+5,mod=(int)1e9+7;
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    string s;
    int n,k;
    cin>>n>>k>>s;
    lp(i,0,n-1)
    {
        if (i+1==k)
            cout<<(char)((s[i]-'A')+'a');
        else cout<<s[i];
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int i, j;
        Scanner sc = new Scanner(System.in);
        
        while(true){
            
            int H = sc.nextInt();        
            int W = sc.nextInt();
            if(H == 0 && W == 0)  break;
            for(i=0; i<H; i++){
                for(j=0; j<W; j++){
                    if(i % 2 == 0){
                        if(j % 2 == 0){
                            System.out.print("#");
                        }else if(j % 2 == 1){
                            System.out.print(".");
                        }
                    }else if(i % 2 == 1){
                        if(j % 2 == 0){
                            System.out.print(".");
                        }else if(j % 2 == 1){
                            System.out.print("#");
                        }
                    }
                }   
                System.out.print("\n");
            }
            System.out.print("\n");
        }
    }
}


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

int main(void){
    char a[102], b[102], c[102];
    cin >> a >> b >> c;
    
    int ia = 0, ib = 0, ic = 0;
    
    char (*now)[102] = &a;
    int *idx = &ia;
    
    while((*now)[*idx]){
        switch((*now)[*idx]){
            case 'a': (*idx)++; now = &a; idx = &ia; break;
            case 'b': (*idx)++; now = &b; idx = &ib; break;
            case 'c': (*idx)++; now = &c; idx = &ic; break;
        }
    }
    
    if(now == &a){
        cout << "A" << endl;
    }else if(now == &b){
        cout << "B" << endl;
    }else{
        cout << "C" << endl;
    } 
    
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef complex<double> com;
typedef pair<ll, ll> P;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main() {
	int n; cin >> n;
	vector<string> a(n);
	rep(i, 0, n) {
		cin >> a[i];
	}
	int ans = 0;
	rep(i, 0, n)rep(j, 0, a[i].size() - 1) {
		if (a[i][j] == 'A' && a[i][j + 1] == 'B') ans++;
	}
	int asum = 0, bsum = 0, basum = 0;
	rep(i, 0, n) {
		if (a[i][0] == 'B' && a[i][a[i].size() - 1] == 'A') {
			basum++; continue;
		}
		if (a[i][0] == 'B') bsum++;
		if (a[i][a[i].size() - 1] == 'A') asum++;
	}
	int add = 0;
	if (asum == 0 && bsum == 0 && basum > 0)add = basum - 1;
	if (asum == 0 && bsum > 0) add = basum;
	if (asum > 0 && bsum == 0) add = basum;
	if (asum > 0 && bsum > 0) {
		asum--; bsum--;
		add = basum + 1 + min(asum, bsum);
	}
	printf("%d", ans + add);
	return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

// Ford-Fulkerson
int INF = 100000;
struct edge { int to, cap, rev; };

vector<edge> G[202];
bool used[202];

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

int dfs(int v, int t, int f) {
   if (v == t) return f;

   used[v] = true;
   for (int i = 0; i < G[v].size(); i++) {
      edge &e = G[v][i];
      if (!used[e.to] && e.cap > 0) {
         int d = dfs(e.to, t, min(f, e.cap));
         if (d > 0) {
            e.cap -= d;
            G[e.to][e.rev].cap += d;
            return d;
         }
      }
   }
   return 0;
}

int max_flow(int s, int t) {
   int flow = 0;
   for (;;) {
      memset(used, 0, sizeof(used));
      int f = dfs(s, t, INF);
      if (f == 0) return flow;
      flow += f;
   }
}

int main() {
   int N;
   cin >> N;
   int Rx[N], Ry[N], Bx[N], By[N];
   for (int i = 0; i < N; i++) {
      cin >> Rx[i] >> Ry[i];
   }
   for (int i = 0; i < N; i++) {
      cin >> Bx[i] >> By[i];
   }
   int s = 2 * N;
   int t = s + 1;
   for (int i = 0; i < N; i++) {
      add_edge(s, i, 1);
      add_edge(i + N, t, 1);
   }
   for (int r = 0; r < N; r++) {
      for (int b = 0; b < N; b++) {
         if (Rx[r] < Bx[b] && Ry[r] < By[b]) {
            add_edge(r, b + N, 1);
         }
      }
   }
   cout << max_flow(s, t) << endl;
   return 0;
}


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

int ans = 0;
int N;
string S;


int solve(string s){
	if (s[0] != '[') {
		return (stoi(s) + 1) / 2;
	}
	int cntL = 0;
	int R = 0;
	int MAXcntL = 0;
	int pL;
	vector<int> A = {};
	for (int i = 0; i < s.size(); i++){
		if (s[i] == '[') {
			cntL ++;
			if (cntL == 1) pL = i;
		} else if (s[i] == ']') {
			cntL --;
			if (cntL == 0) {
				A.push_back(solve(s.substr(pL + 1, i - pL - 1)));
			}
		
		}
	}
	sort(A.begin(), A.end());
	for (int i = 0; i < (A.size() + 1) / 2; i++) {
		R += A[i];
	}
	return R;
}



int main () {
	cin >> N;
	
	for (int n = 0; n < N; n ++) {
		cin >> S;
		ans = solve(S);
		cout << ans << endl;
	}
}


Measured memory_bytes: 3224
from heapq import heappop, heappush
from collections import defaultdict

def inpl(): return list(map(int, input().split()))
N, M, L = inpl()

while N:
    G = [[] for _ in range(N+1)]
    for _ in range(M):
        a, b, d, e = inpl()
        G[a].append([b, d, e])
        G[b].append([a, d, e])

    Q = [[0, 0, 1]] # bandits, distance, where
    cost = [[10**6]*(L+1) for _ in range(N+1)]
    cost[1][0] = 0
    while Q:
        e, d, p = heappop(Q)
        if cost[p][d] < e:
            continue
        if p == N:
            print(e)
            break
        for q, dd, de in G[p]:
            if d + dd <= L and e < cost[q][d+dd]:
                heappush(Q, (e, d+dd, q))
                cost[q][d+dd] = e
            if e + de < cost[q][d]:
                heappush(Q, (e+de, d, q))
                cost[q][d] = e+de
    N, M, L = inpl()


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

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


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

    for (ll l = 0; l < 1000; l++)
    {
        for (ll r = -1000; r < l; r++)
        {
            ll calc = pow(l,5)-pow(r,5);
            if(calc==x)
            {
                cout<<l<<" "<<r<<endl;
                return 0;
            }
        }
        
    }
    
    /*
    if(x==1)
    {
        cout<<"1 0"<<endl;
        return 0;
    }
    ll yaku=1;
    for (ll i = 2; i <= sqrt(x); i++)
    {
        if(x%i==0)
        {
            yaku=i;
            break;
        }
    }
    cout<<yaku<<endl;
    
    ll l=(ll)(pow(__LONG_LONG_MAX__-5,0.2));
    ll r=0;
    while (true)
    {
        ll mid=(l+r)/2;
        ll calc=(ll)(pow(mid,5)-pow(mid-yaku,5));

        cout<<l<<"\t"<<r<<"\t"<<mid<<"\t"<<calc<<endl;//

        if(calc==x)
        {
            cout<<mid<<" "<<mid-yaku<<endl;
            break;
        }
        else if(calc>yaku)
        {
            l=mid;
        }
        else
        {
            r=mid;
        }

    }
    */
    return 0;
}

Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b, c;
    cin >> a >> b >> c;
    //*/
    
    /*
    vector<int> a(3);
    cin >> a.at(0) >> a.at(1) >> a.at(2) ;
    
    sort(a.begin(), a.end());
    */
    
    //*
    if( abs(b - a) <= abs(c - a) ){
        cout << "A" << endl;
    } else {
        cout << "B" << endl;
    }
    //*/
    
    //cout << ( a - 1 ) * ( b - 1 ) << endl;

    return 0; 
}


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

using namespace std;
const long long MAXN = 3e5+5;
const long long MOD = 1e9+7;
long long n;
long long sz[MAXN];
long long fact[MAXN];
long long dp[MAXN];
long long dp2[MAXN];
long long invfact[MAXN];
long long inv[MAXN];
vector<long long> v1[MAXN];
void dfs(long long curr,long long par){
    sz[curr] = 1;
    dp[curr] = 1;
    
    for(long long x:v1[curr]){
        if(x!=par){
            dfs(x,curr);
            sz[curr]+=sz[x];
            //cout<<dp[x]<<endl;
            dp[curr]*=((invfact[sz[x]]%MOD)*(dp[x]))%MOD;
            dp[curr]%=MOD;
        }
    }
 //   cout<<curr<<" "<<fact[sz[curr]-1]<<" "<<dp[curr]<<endl;
    dp[curr]*=fact[sz[curr]-1];
    dp[curr]%=MOD;
    
}
void dfs2(long long curr,long long par){
    if(curr!=1){
        dp[curr] = (((dp[par]*sz[curr])%MOD)*inv[n-sz[curr]])%MOD;
    }
    for(long long x:v1[curr]){
        if(x!=par){
            dfs2(x,curr);
        }
    }
}
int main() {
    cin>>n;
    for(long long i=1;i<n;i++){
        long long x,y;
        cin>>x>>y;
        v1[x].push_back(y);
        v1[y].push_back(x);
        
    }
    inv[1] = 1;
    invfact[1] = 1;
    inv[0]= 1;
    invfact[0] = 1;
    fact[0] = 1;
    fact[1] = 1;
    for(long long i=2;i<=200000;i++){
        fact[i] = 1LL*fact[i-1]*i;
        fact[i]%=MOD;
        
        inv[i]=1LL*(MOD-(MOD/i))*inv[MOD%i]%MOD;
        invfact[i] = invfact[i-1]*inv[i]%MOD;
        //cout<<fact[i]<<" "<<inv[i]<<" "<<invfact[i]<<endl;
    }
    dfs(1,1);
    dfs2(1,1);
    for(long long i=1;i<=n;i++){
        cout<<dp[i]<<endl;
    }
}

Measured memory_bytes: 30448
#include <iostream>
#include <vector>
using namespace std;
int main() {
	vector<char> str;
	for (int i = 0; i<3; i++)
	{
		char s;
		cin>>s;
		str.push_back(s);
	}
	int max = 0;
	int count = 0;
	for (int i = 0; i<3; i++)
	{
		if (str[i] == 'R')
		{
          
			count++;
          	if (max<count)
			{
				max = count;
			}
		}
		else{
			if (max<count)
			{
				max = count;
			}
		count = 0;
		}
	}
	cout << max << endl;
}

Measured memory_bytes: 3608
/* DELAPAN.3gp */
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
using namespace std;

#ifdef DEBUG
	#define debug(...) printf(__VA_ARGS__)
	#define GetTime() fprintf(stderr,"Running time: %.3lf second\n",((double)clock())/CLOCKS_PER_SEC)
#else
	#define debug(...) 
	#define GetTime() 
#endif

//type definitions
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vint;

//abbreviations
#define A first
#define B second
#define MP make_pair
#define PB push_back

//macros
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n)-1; 0 <= i; --i)
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for (int i = (a); (b) <= i; --i)
#define FORIT(it,c) for (__typeof ((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define RESET(a,x) memset(a,x,sizeof(a))
#define EXIST(a,s) ((s).find(a) != (s).end())
#define MX(a,b) a = max((a),(b));
#define MN(a,b) a = min((a),(b));

inline void OPEN(const string &s) {
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

/* -------------- end of DELAPAN.3gp's template -------------- */

ll n, s;

void check(ll b) {
	if (b < 2) {
		return;
	}
	ll sum = 0;
	ll t = n;
	while (t > 0) {
		sum += t % b;
		t /= b;
	}
	if (s == sum) {
		printf("%lld\n", b);
		exit(0);
	}
}

int main(){
	scanf("%lld%lld", &n, &s);

	ll b = 2;
	while (b * b <= n + n) {
		check(b++);
	}

	ll ns = n - s;
	ll ans = n;
	vector<ll> factors;
	for (ll f = 1; f * f <= ns; ++f) {
		if (ns % f == 0) {
			factors.push_back(f);
			factors.push_back(ns / f);
		}
	}
	sort(ALL(factors));
	FORIT(it, factors) {
		check(*it + 1);
	}

	check(n);
	check(n + 1);

	puts("-1");
	
	return 0;
}


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

int main()
{
  string S;
  cin >> S;
  
  int i,f=0;
  while(S[i] != '\0')
  {
    if(i%2 == 1)
    {
      if(S[i] == 'R')
        f=1;
    }else
    {
      if(S[i] == 'L')
        f=1;
    }
    i++;
  }
  
  if(f == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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

#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define cases int t;cin>>t;while(t--)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define per(i,a,b)	for(ll i=a;i>b;i--)

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

ll mod = 1000000007;

using namespace std;
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("inputf.in", "r", stdin);
	freopen("outputf.in", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	string s;
	cin>>s;
	if(s=="ABC"){
		cout<<"ARC";
	}
	else{
		cout<<"ABC";
	}



	return 0;
}

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

using namespace std;

int main() {
    int n,k;
    cin >> n >> k;
    int r,s,p;
    cin >> r >> s >> p;
    string t;
    cin >> t;
    bool check[1000000];
    memset(check, 0, sizeof(check));

    map<char,int> x {
            {'r', p},
            {'s', r},
            {'p', s}
    };
    int score = 0;
    for (int i = 0; i < n; i++) {
        if (i >= k) {
            if (t[i] == t[i - k]) {
                if (!check[i - k]) {
                    check[i] = true;
                    continue;
                }
            }
        }
        score += x[t[i]];
    }
    cout << score << endl;
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    char t1, t2, t3;
    t1 = toupper(s1[0]);
    t2 = toupper(s2[0]);
    t3 = toupper(s3[0]);

    cout << t1 << t2 << t3;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
class LasySegmentTree:
    def __init__(self, size: int, segfunc, lazy_ide_ele=0):
        self.lazy_ide_ele = lazy_ide_ele
        self.segfunc = segfunc
        self.N0 = 1 << (size - 1).bit_length()
        self.lazy = [self.lazy_ide_ele] * (2 * self.N0)

    def gindex(self, left, right):
        L = left + self.N0
        R = right + self.N0
        lm = (L // (L & -L)) >> 1
        rm = (R // (R & -R)) >> 1
        while L < R:
            if R <= rm:
                yield R
            if L <= lm:
                yield L
            L >>= 1
            R >>= 1
        while L:
            yield L
            L >>= 1

    def propagates(self, *ids):
        for i in reversed(ids):
            idx = i - 1
            v = self.lazy[idx]
            if v == self.lazy_ide_ele:
                continue
            self.lazy[2 * idx + 1] = self.segfunc(self.lazy[2 * idx + 1], v)
            self.lazy[2 * idx + 2] = self.segfunc(self.lazy[2 * idx + 2], v)
            self.lazy[idx] = self.lazy_ide_ele

    def update(self, left: int, right: int, x):
        L = self.N0 + left
        R = self.N0 + right

        while L < R:
            if R & 1:
                R -= 1
                self.lazy[R - 1] = self.segfunc(self.lazy[R - 1], x)
            if L & 1:
                self.lazy[L - 1] = self.segfunc(self.lazy[L - 1], x)
                L += 1
            L >>= 1
            R >>= 1

    def query(self, k: int):
        self.propagates(*self.gindex(k, k + 1))
        return self.lazy[k + self.N0 - 1]



from operator import add
from bisect import bisect_right
def resolve():
    N, D, A = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N)]
    AB.sort()
    X, _ = zip(*AB)


    seg_lazy = LasySegmentTree(N+10, segfunc=add)
    ans = 0
    for i in range(N):
        d = AB[i][1] - seg_lazy.query(i)
        if d <= 0:
            continue
        cnt = -(-d//A)
        ans += cnt
        idx = bisect_right(X, (X[i] + 2*D))
        seg_lazy.update(i, idx, cnt*A)
    print(ans)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 132712
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

ll sign(ll x)
{
    if (x >= 0) return 1;
    else return -1;
}

int main()
{
    ll K, X, Y;
    cin >> K >> X >> Y;
    ll U = X + Y, V = X - Y;

    if (K % 2 == 0 and abs(X + Y) % 2)
    {
        puts("-1");
        return 0;
    }

    vector<plii> ret;
    ll kd = K % 2;

    while (U or V)
    {
        ll u, v;
        if (abs(U) <= K and abs(V) <= K)
        {
            if (abs(U) == K and abs(V) % 2 == kd) u = U, v = V;
            else if (abs(V) == K and abs(U) % 2 == kd) u = U, v = V;
            else if ((K - abs(U)) % 2 == kd)
            {
                u = U - K * sign(U);
                v = K * sign(V);
            }
            else if ((K - abs(V)) % 2 == kd)
            {
                u = K * sign(U);
                v = V - K * sign(V);
            }
            else
            {
                u = K * sign(U);
                v = K * sign(V);
            }
        }
        else
        {
            u = K * sign(U), v = K * sign(V);

            if (abs(K - abs(U)) % 2 == kd and abs(U) < K * 2)
            {
                u = U - K * sign(U);
                v = K * sign(V);
            }
            else if (abs(K - abs(V)) % 2 == kd and abs(V) < K * 2)
            {
                u = K * sign(U);
                v = V - K * sign(V);
            }
        }
        ret.emplace_back(u, v);
        U -= u;
        V -= v;
    }

    printf("%d\n", (int)ret.size());
    ll xn = 0, yn = 0;
    for (auto pa : ret)
    {
        ll d1 = (pa.first + pa.second) / 2;
        ll d2 = (pa.first - pa.second) / 2;
        if (abs(d1) + abs(d2) != K) exit(8);
        xn += d1;
        yn += d2;
        printf("%lld %lld\n", xn, yn);
    }
    if (xn != X or yn != Y) exit(8);
}


Measured memory_bytes: 6380
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;



int main(){
ll N;
cin >> N;
vector<ll> A(N,0);
for(ll i=0;i<N;i++){
  cin>>A[i]
;}
//Nが偶数
if(N%2==0){
  vector<ll> yes(N,0);
  vector<ll> no(N,0);
  yes[N-2]=A[N-2];
  no[N-2]=A[N-1];
  for(ll i=N-4;i>=0;i-=2){
    yes[i]=max(A[i]+yes[i+2],A[i]+no[i+2]);
    no[i]=A[i+1]+no[i+2]
  ;}
  cout<<max(yes[0],no[0])<<endl;
}
//Nが奇数
else if(N%2==1){
  vector<ll> yesp(N,0);
  vector<ll> yesm(N,0);
  vector<ll> nom(N,0);
  yesp[N-3]=A[N-1]+A[N-3];
  yesm[N-3]=A[N-3];
  nom[N-3]=max(A[N-2],A[N-1]);
  for(ll i=N-5;i>=0;i-=2){
    yesp[i]=yesp[i+2]+A[i];
    yesm[i]=max(yesm[i+2],nom[i+2])+A[i];
    nom[i]=max(nom[i+2]+A[i+1],yesp[i+2]);
  ;}
  cout<<max(yesm[0],nom[0])<<endl;
}
return 0;
}


Measured memory_bytes: 9520
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  int n, m, X, Y;
  cin >> n >> m >> X >> Y;
  vector<int> x(n), y(m);
  for (int i = 0; i < n; i++){
    cin >> x[i];
  }
  for (int i = 0; i < m; i++){
    cin >> y[i];
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());

  int ok = 0;
  for (int i = X + 1; i <= Y; i++){
    if (x[n-1] < i && i <= y[0])
      ok = 1;
  }

  cout << (ok ? "No " : "") << "War" << endl;

  return 0;
}



Measured memory_bytes: 256
n,k = input().split()
nlist = []
for i in range(int(k)):
    vain = int(input())
    if vain == 1:
        list = [input()]
    else :
        list= input().split()
    nlist.extend(list)
nlist = set(nlist)
c = len(nlist)
print(int(n)-int(c))

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

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long
#define ld long double

#define mod 1000000007
#define EULER 2.7182818284
#define INF 1000000000

#define pb push_back
#define ins insert
#define IT iterator
#define PQ priority_queue
#define    nl           "\n"
#define fi first
#define se second
#define maxe max_element
#define mine min_element
#define er erase
#define lb lower_bound
#define ub upper_bound

#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mpi map<int,int>
#define mpl map<ll,ll>
#define umpi unordered_map<int,int>
#define umpl unordered_map<ll,ll>
#define si set<int>
#define sl set<ll>
#define msi multi_set<int>
#define msl multi_set<ll>

#define mem(v,i) memset(v,i,sizeof(v)) 


#define repab(i,a,b) for(int i=(a);i<=(b);i++)
#define reprab(i,a,b) for(int i=(a);i>=(b);i--)
#define repll(i,a,b) for(ll 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 bs bitset
#define bpc(a) __builtin_popcount(a)
#define tc int t;cin>>t;while(t--)


int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};

ll max(ll a,ll b)
{
    if(a>b)return a;return b;
}
ll min(ll a,ll b)
{
    if(a<b)return a;return b;
}

ll mypow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
ll cnt=1;
ll dfs(ll a, ll n){
    
    if(a%n==0)
    return cnt;
    cnt++;
    /*if(cnt>18)
    return 0;*/
    return dfs((a*10+7)%n,n);
    
}
bool isprime(ll n){
    for(ll i=2;i*i<=n;i++){
        if(n%i==0)
        return false;
    }
    return true;
}
int main()
{   
    
    fast
    ll n;
    cin>>n;
    if(n%2==0||n%5==0)
    cout<<"-1\n";
    else{
        ll k=dfs(7,n);
        cout<<k<<nl;
    }
    
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

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


int main()
{
    int n, AC=0, WA=0, TLE=0, RE=0;
    cin >> n;
    
    rep(i, n)
    {
        string s;
        cin >> s;
        if (s == "AC") AC++;
        if (s == "WA") WA++;
        if (s == "TLE") TLE++;
        if (s == "RE") RE++;
    }
    cout << "AC x "<< AC << "\n" << "WA x " << WA << "\n" << "TLE x " << TLE << "\n" << "RE x " << RE << endl;
    
}

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

using namespace std;

#define sz(a) int(a.size())

typedef long double Double;
typedef long long Long;
struct ConvexHullTrick {
	struct Line {
		Double m,b;
		Line(Double m,Double b):m(m),b(b){}
		Double inter(const Line &L)const{
			return (L.b-b) / (m - L.m);
		}
		long long eval(Double x){
			return m*x + b;
		}
	};
	struct Node {
		Line l = Line(1, 0);
		Double intWithPrev = -1e100;
		vector<int> par, to;
	};
	vector<Node> nodes;
	ConvexHullTrick() {}
	void add(Line l, int version = -1){
		int id = nodes.size();
		Node nn; nn.l = l;
		if(!nodes.empty()) {
			int p = version == -1 ? nodes.size() -1 : version;
			for (int i = nodes[p].par.size(); i >= 0 && p != 0; --i) {
				if (nodes[p].par.size() <= i) continue;
				if (nodes[p].par[i] == 0) continue;
				int pp = nodes[p].par[i];
				int ppp = nodes[pp].par[0];
				if(nodes[ppp].l.inter(l) < nodes[pp].intWithPrev) {
					p = ppp;
				}
				else break;
			}
			while(p != 0) {
				int pp = nodes[p].par[0];
				if(nodes[pp].l.inter(l) < nodes[p].intWithPrev) {
					p = pp;
				} else {
					break;
				}
			}
			nodes[p].to.push_back(id);
			nn.par.push_back(p);
			nn.intWithPrev = nn.l.inter(nodes[p].l);
			for(int i = 0; i < nodes[ nn.par[i] ].par.size(); ++i) {
				int rp = nn.par[i];
				nn.par.push_back(nodes[rp].par[i]);
			}
			assert(nn.par.size() <= 20);
		}
		nodes.push_back(nn);
	}
	long long eval(Double x, int version = -1){
		int n = version == -1 ? nodes.size() - 1 : version;
		for (int i = nodes[n].par.size(); i >= 0; --i) {
			if (nodes[n].par.size() <= i) continue;
			int p = nodes[n].par[i];
			if (x < nodes[p].intWithPrev) {
				n = p;
			}
		}
		if (x < nodes[n].intWithPrev) n = nodes[n].par[0];
		return nodes[n].l.eval(x);
	}
	void print(int n = 0, int lvl = 0) {
		cout << string(lvl * 3, ' ')<< n << " " << nodes[n].intWithPrev << endl;
		for(int v : nodes[n].to)
			print(v, lvl+1);
	}
};

int N;
double memo [310][310][310];
bool vis [310][310][310];

double dp (int c0, int c1, int c2, int c3) {
	if (c0 == N) return 0;
	if (vis[c1][c2][c3]) return memo[c1][c2][c3];
	double p0 = 1.0*c0/N;
	double e1 = c1 ? (1+dp(c0+1, c1-1, c2, c3))*c1/N : 0;
	double e2 = c2 ? (1+dp(c0, c1+1, c2-1, c3))*c2/N : 0;
	double e3 = c3 ? (1+dp(c0, c1, c2+1, c3-1))*c3/N : 0;

	vis[c1][c2][c3] = 1;
	return memo[c1][c2][c3] = (e1+e2+e3+p0)/(1-p0);
}

int main() {
	cin >> N;
	vector <int> c(4);
	for (int i = 0; i < N; i++) {
		int t;
		cin >> t;
		c[t]++;
	}
	printf("%0.9f\n", dp(c[0], c[1], c[2], c[3]));
}

Measured memory_bytes: 256256
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
    return int(input())
def stin():
    return input()
def spin():
    return map(int,stin().split())
def lin():                           #takes array as input
    return list(map(int,stin().split()))
def matrix(n):
    #matrix input
    return [list(map(int,input().split()))for i in range(n)]

################################################
def calculate_sum(a, N): #sum of a to N
    # Number of multiples 
    m = N / a 
    # sum of first m natural numbers 
    sum = m * (m + 1) / 2
    # sum of multiples 
    ans = a * sum
    return ans
def series(N):
    return (N*(N+1))//2

def count2Dmatrix(i,list):
    return sum(c.count(i) for c in list)

def modinv(n,p):
    return pow(n,p-2,p)

def GCD(x, y): 
    x=abs(x)
    y=abs(y)
    if(min(x,y)==0):
        return max(x,y)
    while(y): 
        x, y = y, x % y 
    return x
def LCM (x, y):
    return (x * y) // GCD(x, y)
    
def Divisors(n) : 
    l = []  
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) : 
            if (n // i == i) : 
                l.append(i) 
            else : 
                l.append(i)
                l.append(n//i)
    return l
def isprime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
prime=[]
def SieveOfEratosthenes(n): 
    global prime
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p): 
                prime[i] = False
        p += 1
    f=[]
    for p in range(2, n): 
        if prime[p]: 
            f.append(p)
    return f
q=[]       
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j
# d = {}
 
"""*******************************************************"""
n, x, t = spin()

print(math.ceil(n/x)*t)

Measured memory_bytes: 9344
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9
int i,j,k;

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

    vector<ll>A(N+1,0); //(N)だと配列が0〜N-1までしか取らないため、N+1にしなくては行けない
                        //(,0)ってすれば初期化できる

    for(i=0;i<N-1;i++){
        int a;
        cin >> a;
        A[a]++;
    }

    for(i=1;i<=N;i++){
        cout << A[i] << endl;
    }

}

Measured memory_bytes: 4848
import math

a, b, h, m = map(int, input().split())
h_angle = (360 * h / 12) + 30 * m / 60
m_angle = 360 * m / 60
angle = abs(h_angle - m_angle)
aa = a * a + b * b - 2 * a * b * math.cos(math.radians(angle))
print(math.sqrt(aa))



Measured memory_bytes: 9420
package main

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

func main() {
	X := nextInt()
	Y := nextInt()

	for x := 0; x <= X; x++ {
		y := X - x
		if x*2+y*4 == Y {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


Measured memory_bytes: 1788
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-23 17:24:58
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

template <class T>
class Dijkstra {
 public:
  Dijkstra(int node_size) : node_size_(node_size) { Initialize(); }
  void Add_Edge(int from, int to, T cost) {
    graph_[from].push_back({to, cost});
  }
  void Solve(int source) {
    std::priority_queue<std::pair<T, int>, std::vector<std::pair<T, int>>,
                        std::greater<std::pair<T, int>>> pq;
    distance_[source] = 0;
    pq.push({0, source});

    while (!pq.empty()) {
      std::pair<T, int> top = pq.top();
      pq.pop();
      int v = top.second;
      if (distance_[v] < top.first) continue;
      for (const auto& e : graph_[v]) {
        if (distance_[e.to] > distance_[v] + e.cost) {
          distance_[e.to] = distance_[v] + e.cost;
          pq.push({distance_[e.to], e.to});
        }
      }
    }
  }
  T operator[](int to) const { return distance_[to]; }

 private:
  struct edge {
    int to;
    T cost;
  };
  int node_size_;
  std::vector<T> distance_;
  std::vector<std::vector<edge>> graph_;
  void Initialize() {
    distance_.assign(node_size_, std::numeric_limits<T>::max() / 2);
    graph_.resize(node_size_);
  }
};

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

  int n, u, v; cin >> n >> u >> v;
  --u; --v;

  Dijkstra<int> dij_t(n);
  Dijkstra<int> dij_a(n);

  for (int i = 0; i < n - 1; ++i) {
    int a, b; cin >> a >> b;
    --a; --b;
    dij_a.Add_Edge(a, b, 1);
    dij_a.Add_Edge(b, a, 1);
    dij_t.Add_Edge(a, b, 1);
    dij_t.Add_Edge(b, a, 1);
  }

  dij_t.Solve(u);
  dij_a.Solve(v);

  int mx = -1;
  int ans = 0;

  for (int i = 0; i < n; ++i) {
    if (dij_t[i] < dij_a[i] && dij_a[i] > mx) {
      mx = dij_a[i];
      ans = dij_a[i] - 1;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 13476
import java.util.Scanner;
import java.util.HashSet;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        HashSet<String> set = new HashSet<String>();

        String x,y;
        int n = sc.nextInt();
        int i;

        for(i = 0;i < n;i++){
            x = sc.next();
            y = sc.next();

            if(x.equals("insert")){
                set.add(y);
            }

            if(x.equals("find")){
                if(set.contains(y)){
                    System.out.printf("yes\n");
                }else{
                    System.out.printf("no\n");
                }
            }
        }
    }
}


Measured memory_bytes: 333804
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
#define MPlus(x,y) {x=(x+y)%M;}
#define MSub(x,y) {x=(x-y+M)%M;}
#define MMul(x,y) {x=(x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  int sum=0,s=0;
  cin>>n;
  rep(i,n){
    int a,b;
    cin>>a>>b;
    s+=b;
    sum+=a*b;
  }

  cout<<s-1+(sum-1)/9<<endl;

}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
 
sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**10
mod = 10**9+7
 
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
 
 
def main():
    n = I()
    s = set()
    for _ in range(n):
        a = I()
        if a in s:
            s.remove(a)
        else:
            s.add(a)
 
    return len(s)
 
print(main())

Measured memory_bytes: 72664