akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

//Defend the Bases
public class Main{

	int[] bipartiteMatching(boolean[][] graph) {
		int n = graph.length;
		if(n==0)return new int[0];
		int m = graph[0].length;
		int[] match = new int[m];
		Arrays.fill(match, -1);
		int res = 0;
		for (int i = 0; i < n; i++) {
			boolean[] visited = new boolean[m];
			if (go(i,graph,visited,match)) res++;
		}
		return match;
	}
	boolean go(int v,boolean[][] graph,boolean[] visited,int[] match) {
		int m = graph[0].length;
		for (int i = 0; i < m; i++)  if (!visited[i] && graph[v][i] && match[i] == -1) {
			visited[i] = true;
			match[i] = v;
			return true;
		}
		for (int i = 0; i < m; i++) if (!visited[i] && graph[v][i]) {
			visited[i] = true;
			if (go(match[i],graph,visited,match)) {
				match[i] = v;
				return true;
			}
		}
		return false;
	}
	
	double EPS = 1e-9;
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if((n|m)==0)break;
			int[][] a = new  int[n][2];
			int[] v = new int[n];
			for(int i=0;i<n;i++){
				for(int j=0;j<2;j++)a[i][j] = sc.nextInt();
				v[i] = sc.nextInt();
			}
			int[][] b = new int[m][2];
			for(int i=0;i<m;i++)for(int j=0;j<2;j++)b[i][j]=sc.nextInt();
			double[][] t = new double[n][m];
			double max = 0;
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					t[i][j] = Math.hypot(a[i][0]-b[j][0], a[i][1]-b[j][1])/v[i];
					max = Math.max(max, t[i][j]);
				}
			}
			double l = 0;
			double r = max+EPS;
			for(;;){
				if(Math.abs(r-l)<EPS){
					System.out.printf("%.8f\n", l);
					break;
				}
				double mid = (l+r)/2;
				boolean[][] map = new boolean[n][m];
				for(int i=0;i<n;i++)for(int j=0;j<m;j++)if(t[i][j]<mid+EPS)map[i][j] = true;
				int[] res = bipartiteMatching(map);
				int c = 0;
				for(int i:res)if(i!=-1)c++;
				if(c==m)r=mid;
				else l=mid;
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

using namespace std;

int gcd(int x, int y){
    int a = x % y;
    if(a == 0){
        return y;
    }else{
        int ans = gcd(y, a);
        return ans;
    }
}

int main(){
    int x, y;
    scanf("%d %d", &x, &y);
    int ans;
    if(x > y){
        ans = gcd(x, y);
    }else{
        ans = gcd(y, x);
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 3216
import java.util.*;


class Graph {
    private int totalVertex;
    private LinkedList<LinkedList<Integer>> adjList;
    public Graph() { totalVertex = 0; }
    public void loadAdjList() {
        Scanner in = new Scanner(System.in);
        totalVertex = in.nextInt();
        adjList = new LinkedList<LinkedList<Integer>>();
        for(int i = 0; i < totalVertex; i ++) {
            LinkedList<Integer> tmp = new LinkedList<Integer>();
            int idx1 = in.nextInt() - 1;
            int degree = in.nextInt();
            for(int j = 0; j < degree; j ++) {
                int idx2 = in.nextInt() - 1;
                tmp.add(idx2);
            }
            adjList.add(tmp);
        }
        in.close();
    }

    public int[] BFS(int s) {
        int[] distance = new int[totalVertex];
        boolean[] visited = new boolean[totalVertex];
        ArrayList<Integer> toVisit = new ArrayList<Integer>();
        toVisit.add(s);
        for (int i = 0; i < totalVertex; i++) {
            distance[i] = -1;
            visited[i] = false;
        }
        visited[s] = true;
        distance[s] = 0;
        while (toVisit.size() > 0) {
            int vertex = toVisit.remove(0);
            Iterator<Integer> neighbors = adjList.get(vertex).iterator();
            while (neighbors.hasNext()) {
                int next = neighbors.next();
                if (!visited[next]) {
                    toVisit.add(next);
                    distance[next] = distance[vertex] + 1;
                    visited[next] = true;
                }
            }
        }
        return distance;
    }
}

public class Main {
    public static void main(String[] args) {
       Graph g = new Graph();
       g.loadAdjList();
       int[] distance = g.BFS(0);
       for (int i = 0; i < distance.length; i++)
           System.out.println((i+1) + " " + distance[i]);
    }
}



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

int main(int argc, char const *argv[])
{
	int n,max_num = -1000001,min_num = 1000001,tmp;
	long long sum=0;
	cin>>n;
	 for(int i = 0; i < n; i++){
        cin>>tmp;
        sum += tmp;
        max_num = max(max_num,tmp);
        min_num = min(min_num,tmp);
    }
		cout<<min_num<<" "<<max_num<<" "<<sum<<endl;
	
	return 0;
}


Measured memory_bytes: 3092
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::cmp::{min, max};

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut scan = Scanner::new(cin);

    let n = scan.read::<i32>();
    let a = scan.read::<i32>();
    let b = scan.read::<i32>();

    println!("{} {}", min(a, b), max(0, (a+b) - n));
}

// region template
#[allow(dead_code)]
fn uz(i: i32) -> usize { i as usize }

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read_opt<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read_opt().unwrap()
    }
}
// endregion


Measured memory_bytes: 4352
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	mod int = 1e9 + 7
)

func main() {
	N := getInt()
	fmt.Println((N - 1) / 2)
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 640
require 'prime'

n = gets.to_i

h = Hash.new(0)
1.upto(n) {|i| i.prime_division.each {|k,v| h[k] += v}}

@h = h.values.sort_by {|e| -e} << 0
bi =->x{@h.bsearch_index{|e| e < x}}

p bi[74] + bi[24] * (bi[2]-1) + bi[14] * (bi[4]-1) + bi[4] * (bi[4]-1) * (bi[2]-2) / 2

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

int s[2005];
long long modd = 1e9+7;
long long num1[2005];
long long num2[2005];

typedef long long ll;

ll qpow(ll a, ll n)//计算a^n % mod
{
    ll re = 1;
    while(n)
    {
        if(n & 1)//判断n的最后一位是否为1
            re = (re * a) % modd;
        n >>= 1;//舍去n的最后一位
        a = (a * a) % modd;//将a平方
    }
    return re % modd;
}
ll inv(ll x){
	return qpow(x,modd-2);
}

int main()
{
    memset(num1, 0, sizeof(num1));
    memset(num2, 0, sizeof(num2));
	int n;
	long long k;
    scanf("%d%lld", &n, &k);
    bool falg = false;
	for(int i = 0; i < n; i++){
    	scanf("%d", &s[i]);
	}
    long long ans = 0;
    for(int i = 0; i < n-1; i++){
    	for(int j = i+1; j < n; j++){
    		if(s[i]>s[j]) num1[i]++;
		}
	}
    for(int i = n-1; i > 0; i--){
    	for(int j = i-1; j >= 0; j--){
    		if(s[i]>s[j]) num2[i]++;
		}
	}
	long long kk = 0;
	kk = ((((1+k)*k)%modd)*inv(2))%modd;
	//cout << kk << endl;
	for(int i = 0; i < n; i++){
		ans = (ans + num1[i]*kk%modd + num2[i]*(kk-k)%modd+modd)%modd;
		
	}
	
	printf("%lld\n", ans);
    return 0;
}
/*


*/

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

char s[200010];
char t[200010];
char d[200010];
int main()
{
	int N, Q;
	scanf("%d%d %s", &N, &Q, s);
	for (int i = 0; i < Q; i++) {
		scanf(" %c %c", &t[i], &d[i]);
	}
	int ok = N, ng = -1;
	while (abs(ng - ok) > 1) {
		int cen = (ok + ng) / 2;

		int cur = cen;
		bool dead = false;
		for (int i = 0; i < Q; i++) {
			if (cur < 0) {
				dead = true;
				break;
			}
			if (cur >= N) {
				break;
			}
			if (s[cur] == t[i]) {
				if (d[i] == 'L') {
					cur--;
				} else {
					cur++;
				}
			}
			if (cur < 0) {
				dead = true;
				break;
			}
			if (cur >= N) {
				break;
			}
		}

		if (dead) {
			ng = cen;
		} else {
			ok = cen;
		}
	}
	int lok = ok;

	ok = -1, ng = N;
	while (abs(ng - ok) > 1) {
		int cen = (ok + ng) / 2;

		int cur = cen;
		bool dead = false;
		for (int i = 0; i < Q; i++) {
			if (cur >= N) {
				dead = true;
				break;
			}
			if (cur < 0) {
				break;
			}
			if (s[cur] == t[i]) {
				if (d[i] == 'L') {
					cur--;
				} else {
					cur++;
				}
			}
			if (cur >= N) {
				dead = true;
				break;
			}
			if (cur < 0) {
				break;
			}
		}

		if (dead) {
			ng = cen;
		} else {
			ok = cen;
		}
	}
	int rok = ok;

	printf("%d\n", rok - lok + 1);
}

Measured memory_bytes: 768
import sys
from collections import defaultdict,Counter
input = sys.stdin.readline
h,w,m=map(int, input().split())
hs=[]
ws=[]
hw=defaultdict(int)
for i in range(m):
    h0,w0=map(int, input().split())
    hw[(h0,w0)]+=1
    hs.append(h0)
    ws.append(w0)

hd=Counter(hs)
wd=Counter(ws)
hmax=max(hd.values())
wmax=max(wd.values())

max_h_list=[kv[0] for kv in hd.items() if kv[1] == hmax]
max_w_list=[kv[0] for kv in wd.items() if kv[1] == wmax]
ans=float('inf')

for x in max_h_list:
    for y in max_w_list:
        if hw[(x,y)]==1:
            ans=min(ans,1)
        else:
            ans=min(ans,0)
            break
print(hmax+wmax-ans)

Measured memory_bytes: 252940
### subroutines

def quantity(ac, c1, c2, b)
  ac + (b - ac * c1) / c2
end

### main

while true
  line = gets.strip
  break if line == '0'

  q1, b, c1, c2, q2 = line.split(' ').map{|s| s.to_i}
  #p [q1, b, c1, c2, q2]

  max_q = quantity(1, c1, c2, b)
  if max_q < q1
    puts "NA"
    next
  end

  ac = 1
  max_ac = [q2, b / c1].min

  while ac < max_ac && quantity(ac + 1, c1, c2, b) >= q1
    ac += 1
  end

  nc = (b - ac * c1) / c2
  puts [ac, nc].join(' ')
end

Measured memory_bytes: 6096
#include<iostream>
using namespace std;
int n,a[50];
int s(int i,int m)
{
    if(m==0) return 1;
    if(i>=n) return 0;
    int r=s(i+1,m)||s(i+1,m-a[i]);
    return r;
}
int main()
{
    int p,m,i;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    cin>>p;
    for(i=0;i<p;i++)
    {
        cin>>m;
        if(s(0,m))
        cout<<"yes"<<endl;
        else
        cout<<"no"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3120
using System;
using System.Collections.Generic;
using System.Linq;
 
static class Program
{
    static void Main(string[] args)
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        //入力
        var list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        var list2 = Console.ReadLine().Split(' ').Select(long.Parse);
   
        //処理
        var result = list2.OrderByDescending(x => x).Skip(list[1]).Sum();
        
        Console.WriteLine(result);

        Console.Out.Flush();
    }

}

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

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

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<int> p(n+1),t(n+1);
    p[0]=0,t[0]=0;
    rep(i,n) cin >> p[i+1] >> t[i+1];
    vector<vector<int>> dp(n+1,vector<int>(3,IINF));
    dp[0][0]=0;
    int ans=IINF;
    repp(i,1,n+1){
      rep(j,3){
        if(p[i-1]*(j+2)+p[i]<=t[i]-t[i-1]){
          dp[i][0]=min(dp[i][0],dp[i-1][j]+p[i-1]+p[i]);
        }
      }
      repp(j,1,3){
        if((j+1)*abs(p[i-1]-p[i])<=t[i]-t[i-1]){
          dp[i][j]=min(dp[i][j],dp[i-1][j-1]+abs(p[i-1]-p[i]));
        }
      }
      bool ok=false;
      rep(j,3){
        if(dp[i][j]<IINF) ok=true;
      }
      if(!ok){
        cout << "NG" SP i << endl;
        goto next;
      }
    }
    rep(i,3) ans=min(ans,dp[n][i]+p[n]);
    cout << "OK" SP ans << endl;
    next:;
  }
  return 0;
}



Measured memory_bytes: 3100
#include<stdio.h>
int main(){
  int t,h,s,sum;
  while(scanf("%d %d %d",&t,&h,&s),t!=-1&&h!=-1&&s!=-1){
    sum = 120*60 - t*3600 - h*60 - s;
    printf("%02d:%02d:%02d\n",sum/3600,(sum/60)%60,sum%60);
    sum *= 3;
    printf("%02d:%02d:%02d\n",sum/3600,(sum/60)%60,sum%60);
  }  
  return(0);
}



Measured memory_bytes: 2644
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
void f(int a[][10],int b[],int c,int e,int n,int t){
  int i;
  if(c==e){
    if(b[c]==-1||b[c]>t)
      b[c]=t;
  }else if(b[c]==-1||b[c]>t){
    b[c]=t;
    for(i=0;i<n;i++){
      if(a[c][i]!=-1)
	f(a,b,i,e,n,t+a[c][i]);
    }
  }
  return;
}    
int main(){
  int i,j;
  int z[10][10],a[10][10],b[10],bmn,tmn,sum,n,m;
  for(;;){
    cin>>n;
    if(n==0)
      break;
    memset(a,-1,sizeof(a));
    m=0;
    for(i=0;i<n;i++){
      int p,q,r;
      cin>>p>>q>>r;
      a[p][q]=r;
      a[q][p]=r;
      m=max(max(m,p),q);
    }
    m++;
    for(i=0;i<m-1;i++){
      for(j=i+1;j<m;j++){
	memset(b,-1,sizeof(b));
	f(a,b,i,j,m,0);
	z[i][j]=b[j];
	z[j][i]=b[j];
      }
    }
    tmn=-1;
    for(i=0;i<m;i++){
      sum=0;
      for(j=0;j<m;j++){
	if(i!=j)
	  sum+=z[i][j];
      }
      if(tmn==-1||tmn>sum){
	tmn=sum;
	bmn=i;
      }
    }
    cout<<bmn<<" "<<tmn<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
// 2508.cpp
//
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=100;
int k[MAX_N], n;
char a[52];
string s;

void solve(){
  int L=s.length();
  for(int i=0;i<L;++i){
    int x;
    for(int j=0;j<52;++j){
      if(s[i]==a[j]){
        x=j-k[i%n];

        if(x<0) x+=52;
        else if(x>=52) x-=52;

      }
    }
    cout<<a[x];
  }
  cout<<endl;
}
int main() {
  for(int i=0;i<52;++i){
    if(i<26)a[i]='a'+i;
    else a[i]='A'+i-26;
  }

  while(cin>>n,n){
    for(int i=0;i<n;++i)cin>>k[i];
    cin>>s;
    solve();
  }
  return 0;
}



Measured memory_bytes: 3224
#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(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

string S;

int main() {
	cin >> S;
	
	bool ans = true;
	REP(i, S.size()) {
		if (S[i] == 'U' || S[i] == 'D') continue;
		if (i % 2 == 0 && S[i] == 'R') continue;
		if (i % 2 == 1 && S[i] == 'L') continue;
		ans = false;
	}
	
	puts(ans ? "Yes": "No");
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;

inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};


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

    int n;
    cin >> n;

    if(n & 1){
        cout << 0 << '\n';
        return 0;
    }else{
        int sum2 = 0;
        for(int i = 2; i <= 1e18 && i > 0; i >>= 1){
            sum2 += n / i;
        }
        int sum5 = 0;
        for(int i = 5; i <= 1e18 && i > 0; i *= 5){
            if(i & 1){
                sum5 += n / i / 2;
            }else{
                sum5 += n / i;
            }
        }

        cout << min(sum2, sum5) << '\n';
    }

    return (0);
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
int n,x,y,s;
int main()
{
	cin>>n;
	for(int i=0;i<n;++i)
	{
		cin>>x>>y;
		if(x!=y) s=0;
		else ++s;
		if(s==3)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3620
import sys
from fractions import gcd


def eratosthenes_generator():
    yield 2
    n = 3
    h = {}
    while True:
        m = n
        if n in h:
            b = h[n]
            del h[n]
        else:
            b = n
            yield n
        m += b << 1
        while m in h:
            m += b << 1
        h[m] = b
        n += 2


def prime(n):
    ret = []
    for i in eratosthenes_generator():
        if n % i == 0:
            ret.append(i)
            while n % i == 0:
                n = n // i
        if n == 1 or i * i > n:
            break
    if n > 1:
        ret.append(n)
    return ret


def solve(n, aaa):
    g = abs(aaa[-1])
    for a in aaa[:-1]:
        if a != 0:
            g = gcd(g, abs(a))
    ans = set(prime(g))

    for p in eratosthenes_generator():
        if p > n + 2:
            break
        if p in ans or aaa[0] % p != 0:
            continue
        q = p - 1
        if all(sum(aaa[i::q]) % p == 0 for i in range(q)):
            ans.add(p)

    ans = sorted(ans)
    return ans


n = int(input())
aaa = list(map(int, sys.stdin))
aaa.reverse()
print('\n'.join(map(str, solve(n, aaa))))


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

int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];
  int ans = 0;
  while (true) {
    bool exist_odd = false;
    rep(i, n) {
      if (a[i] % 2 != 0) exist_odd = true;
    }
    if (exist_odd) break;
    rep(i, n) a[i] /= 2;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N, K;
  cin >> N >> K;
  double ans = 0;
  for (int i = 1; i < N+1; i++) {
    double p = 1.0 / N;
    int c = i;
    while(c < K) {
      p *= 0.5;
      c *= 2;
    }
    ans += p;
  }
  printf("%.13f\n", ans);
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int M = Integer.parseInt(sc.next());
        int[] a = new int[M];
        int[] b = new int[M];
        
        Map<Integer, List<Integer>> map = new HashMap<>();
        for(int i=0; i<M; i++) {
            a[i] = Integer.parseInt(sc.next());
            b[i] = Integer.parseInt(sc.next());
            if(map.containsKey(a[i])) map.get(a[i]).add(b[i]);
            else {
                map.put(a[i], new ArrayList<Integer>());
                map.get(a[i]).add(b[i]);
            }
            if(map.containsKey(b[i])) map.get(b[i]).add(a[i]);
            else {
                map.put(b[i], new ArrayList<Integer>());
                map.get(b[i]).add(a[i]);
            }
        }
        
        String ans = "IMPOSSIBLE";
        for(int x : map.get(1)) {
            for(int y : map.get(x)) {
                if(y == N) {
                    ans = "POSSIBLE";
                    break;
                }
            }
        }
        System.out.println(ans);
        
        
    }
}


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

int dp[10005];

int main() {
  int n, ww; cin >> n >> ww;
  for (int i = 1; i < 10005; i++)
    dp[i] = -0x3f3f3f3f;
  for (int i = 0; i < n; i++) {
    int v, w; cin >> v >> w;
    for (int i = ww; i - w >= 0; i--)
      dp[i] = max(dp[i], dp[i - w] + v);
  }
  int ans = 0;
  for (int i = 0; i <= ww; i++)
    ans = max(ans, dp[i]);
  cout << ans << endl;
}


Measured memory_bytes: 3136
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>

using namespace std;

#define INF (int)1e8
#define _INF (int)-1e8  
#define INFLL (long long)1e15
#define _INFLL (long long)-1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

/*******************************************************/

class Union_Find {
private:
  vi parent, rank;
public:
  Union_Find(int N) {
    parent.resize(N);
    rank.resize(N);
    Loop(i, N) {
      parent[i] = i;
      rank[i] = 0;
    }
  }
  int find(int x) {
    if (parent[x] == x) return x;
    else return parent[x] = find(parent[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) parent[x] = y;
    else {
      parent[y] = x;
      if (rank[x] == rank[y]) rank[x]++;
    }
  }
  bool is_same(int x, int y) {
    return find(x) == find(y);
  }
};

typedef pair<ll, int> p_t;

ll solve(vvll A) {
  if (A.size() == 1) return 0;
  ll m = A.size() - 1;
  ll sum = 0;
  Loop(i, A.size()) {
    sum += A[i].back();
    A[i].pop_back();
  }
  vll a;
  Loop(i, A.size()) {
    Loop(j, A[i].size()) {
      a.push_back(A[i][j]);
    }
  }
  if (a.size() < m * 2 - A.size()) return -1;
  else {
    sort(a.begin(), a.end());
    Loop(j, m * 2 - A.size()) {
      sum += a[j];
    }
    return sum;
  }
}

// Union_Find sample
int main() {
  int n, m; cin >> n >> m;
  vll a(n); Loop(i, n) cin >> a[i];
  Union_Find *uf = new Union_Find(n);
  Loop(i, m) {
    int x, y; cin >> x >> y;
    uf->unite(x, y);
  }
  map<int, vll> mp;
  Loop(i, n) {
    mp[uf->find(i)].push_back(a[i]);
  }
  vvll A;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    sort(itr->second.begin(), itr->second.end(), greater<ll>());
    A.push_back(itr->second);
  }
  ll ans = solve(A);
  if (ans == -1) cout << "Impossible" << endl;
  else cout << ans << endl;
  return 0;
}

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

int b[200001], a[200001];
signed main() {
	int n, q, s, t; scanf("%lld%lld%lld%lld", &n, &q, &s, &t);
	rep(i, n + 1) {
		scanf("%lld", &b[i]);
		if (i)a[i] = b[i] - b[i - 1];
	}
	int x = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] >= 0)x -= a[i] * s;
		else x -= a[i] * t;
	}
	rep(i, q) {
		int l, r, y; scanf("%lld%lld%lld", &l, &r, &y);
		if (a[l] >= 0)x += a[l] * s;
		else x += a[l] * t;
		a[l] += y;
		if (a[l] >= 0)x -= a[l] * s;
		else x -= a[l] * t;
		if (r < n) {
			if (a[r + 1] >= 0)x += a[r + 1] * s;
			else x += a[r + 1] * t;
			a[r + 1] -= y;
			if (a[r + 1] >= 0)x -= a[r + 1] * s;
			else x -= a[r + 1] * t;
		}
		printf("%lld\n", x);
	}
}

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

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

int main(){
  int i,N,K,a[200000];
  char ss[10000];
  scanf("%d",&N);
  scanf("%d",&K);
  if(N<K){
	  printf("0");
  }else{
	  printf("10");
  }
  return 0;
}

Measured memory_bytes: 256
import Control.Monad

inf = 10000000

int2bin :: Int -> Int -> [Int]
int2bin 0 _ = []
int2bin n a = mod a 2 : int2bin (n-1) (a `div` 2)

listAdd :: [Int] -> [Int] -> [Int]
listAdd [] _ = []
listAdd _ [] = []
listAdd (x:xs) (y:ys) = x+y : listAdd xs ys

allListAdd :: [[Int]] -> [Int] -> [Int]
allListAdd [] _ = [0,0..]
allListAdd (x:xs) (b:bs) = listAdd (allListAdd xs bs) $ if b == 0 then take (length x) [0,0..] else x

solve :: Int -> Int -> Int -> [[Int]] -> [[Int]] -> Int
solve n m x a [] = inf
solve n m x a (b:bs) = do
    let sum_list = allListAdd a b
    let tmpans = if length (filter (\ys -> ys < x) $ tail sum_list) == 0
                    then head sum_list
                    else inf
    min tmpans $ solve n m x a bs

main = do
    l <- getLine
    let (n:m:x:_) = map read (words l) :: [Int]
    aa <- replicateM n getLine
    let a = map (map read) $ map words aa :: [[Int]]
    let border = subtract 1 $ product $ take n [2,2..]
    let comBin = map (int2bin n) [1..border]
    let ans = solve n m x a comBin
    print $ if ans == inf
               then -1
               else ans




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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;

// typedef
typedef pair<int, int> P;
typedef tuple<int, int, int> P3;
typedef vector<vector <int>> Graph;

bool can(int a) {
    if (0 <= a && a <= 9) {
        return true;
    } else {
        return false;
    }
}
int main() {
    int a, b;
    cin >> a >> b;
    if (can(a) && can(b)) {
        cout << a * b << endl;
    } else {
        out(-1);
    }
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	const temp = input.split(" ").map(x => +x)
	console.log(temp[0] == temp[1] && temp[1] == temp[2] && temp[0] != 0 ? "Yes" : "No")
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<algorithm>
#include<iostream>
using namespace std;
using ll=long long;


int main() {
	ll n;
	cin >> n;
	ll a, b;
	ll bA, bB;
	cin >> a >> b;
	bA = a;
	bB = b;

	for (ll i = 1;i < n;i++) {
		cin >> a >> b;
		ll aa = bA / a;
		if (bA % a != 0) aa++;
		ll bb = bB / b;
		if (bB % b != 0) bb++;

		ll ret = max(aa, bb);

		bA = a * ret;
		bB = b * ret;
	}

	cout << bA + bB << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,n,s) for(int i=(int)(s);i<(int)(n);++i)
#define RREP(i,n,s) for(int i=(int)(s);i>=(int)(n);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

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

    vector<set<int>> v(26);
    REP(i, s.length()) {
        int n = s[i] - 'a';
        v[n].insert(i);
    }

    sort(ALL(v), [](const set<int>& a, const set<int>& b){
        if(a.size() != b.size()) {
            return (a.size() > b.size());
        }
        return (*(a.begin()) < *(b.begin()));
    });

    vector<set<int>> v2(26);
    REP(i, s.length()) {
        int n = t[i] - 'a';
        v2[n].insert(i);
    }

    sort(ALL(v2), [](const set<int>& a, const set<int>& b){
        if(a.size() != b.size()) {
            return (a.size() > b.size());
        }
        return (*(a.begin()) < *(b.begin()));
    });

    REP(i, 26) {
        if (v[i] != v2[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

}


Measured memory_bytes: 19336
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef _DEBUG

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 105
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
class Solution {
public:
	void solve() {
		scanf("%d %d", &N, &M);
		if (M & 1) {
			puts("-1");
			return;
		}
		boss = vector <int>(N + 1);
		for (int i = 1; i <= N; i++) boss[i] = i;

		G = vector <vector <int>>(N + 1, vector <int>());
		outdeg = vector <int>(N + 1, 0);
		while (M--) {
			int a, b;
			scanf("%d %d", &a, &b);
			if (find(a) != find(b)) {
				G[a].push_back(b);
				G[b].push_back(a);
				boss[find(a)] = find(b);
			}
			else {
				printf("%d %d\n", a, b);
				outdeg[a] ^= 1;
			}
		}
		visited = vector <bool>(N + 1, false);
		DFS(1, 1);
	}

protected:
	void DFS(int u, int father) {
		visited[u] = true;
		for (int v : G[u]) if (!visited[v] and v != father) DFS(v, u);
		if (u != father) {
			if (outdeg[u] & 1) {
				printf("%d %d\n", u, father);
				outdeg[u] ^= 1;
			}
			else {
				printf("%d %d\n", father, u); 
				outdeg[father] ^= 1;
			}
		}
	}

	int find(int x) {
		return boss[x] = (boss[x] == x ? x : find(boss[x]));
	}

private:
	int N, M;
	vector <int> boss;
	vector <vector <int>> G;
	vector <int> outdeg;
	vector <bool> visited;
};
/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	// WF("output.txt");
	DF("err.txt");

	Solution().solve();
	return 0;
}

Measured memory_bytes: 11008
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner stdIn = new Scanner (System.in);

		int num = stdIn.nextInt();
		int h = num / 3600;
		num %= 3600;
		int m = num / 60;
		num %= 60;
		System.out.println(h + ":" + m + ":" + num);

	}

}

Measured memory_bytes: 26220
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a == b) {
		cout << 0 << endl;
		return 0;
	}
	if ((a + b) % 2 == 0) {
		cout << (a + b) / 2 << endl;
		return 0;
	}
	if ((b - a) % 2 == 0) {
		cout << (b - a) / 2 << endl;
		return 0;
	}
	cout << "IMPOSSIBLE" << endl;
}
	


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

int main()
{
	int n,sta = 1;
	cin >> n;
	int ans[33] = {};
	for (int i = 1; i <= 32; ++i)
	{
		ans[i] = abs(n % 2);
		sta = ((ans[i])?i:sta);
		if(i % 2 == 0 && n > 0)
		{
			++n;
		}
		else if(i % 2 == 1 && n < 0)
		{
			--n;
		}
		n /= 2;
	}
	for (int i = sta; i >= 1; --i)
	{
		cout << ans[i];
	}
	cout << endl;
	return 0;
}

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

using namespace std;

const int maxn = 1e5 + 5;
vector<int> G[maxn];
vector<int> rG[maxn];
int deg[maxn];

int n, m;

int dp[maxn];

int main(){
    cin >> n >> m;
    for(int i = 1;i <= m;i++){
        int u, v;
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        rG[v].push_back(u);
        deg[u]++;
    } 
    queue<int> q;
    for(int i = 1;i <= n;i++){
        if(deg[i] == 0){
            dp[i] = 0;
            q.push(i);
        }
    }
    int ans = 0;
    while(!q.empty()){
        int p = q.front(); q.pop();
        for(auto v : G[p]){
            dp[p] = max(dp[p], dp[v] + 1);
        }
        ans = max(ans, dp[p]);
        for(auto v : rG[p]){
            deg[v]--;
            if(deg[v] == 0){
                q.push(v);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,a,b) for(i64 i=(int64_t)(a);i<(int64_t)(b);i++)
#define repn(i,n) rep(i,0,n)
#define sort(i,t) qsort(i.data(),i.size(),sizeof(t),[](const void*a, const void*b)->int{if((*(t*)a)>(*(t*)b))return 1;if((*(t*)a)<(*(t*)b))return -1;return 0;})
void din() {} void dout() { cout << endl; }
template <typename T, typename ... Args> inline void din(T& head, Args& ... rest) { cin >> head; din(rest...); }
template <typename T, typename ... Args> inline void dout(T head, Args ... rest) { cout << head; if (sizeof...(rest)) cout << ' '; dout(rest...); }

int main()
{
	int a, b, c;
	din(a, b, c);
	vector<int> v = { a,b,c };
	sort(v, int);
	dout(v[2] * 10 + v[1] + v[0]);
}

Measured memory_bytes: 256
from collections import Counter
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k]+C[k][j])
print(sum(C[k][1]*v for k, v in Counter(a for aa in A for a in aa).items() if abs(k) != 1))

Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n,m;cin>>n>>m;
    vector<vector<int>> jobs(m+1);
    for(int i = 0; i<n;++i){
        int a,b;cin>>a>>b;
        if(a>m)continue;
        jobs[a].push_back(b);
    }
    int ans = 0;
    priority_queue<int> q;
    for(int i = 1; i <= m; ++i){
        for(int x: jobs[i]){
            q.push(x);
        }
        if(!q.empty()){
            ans+=q.top();
            q.pop();
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5504
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+18;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

map<ll,ll> mp;
ll A,B,C,D;
ll dfs(ll N){
    ll res=INF+10;
    if(mp.count(N)) return mp[N];
    if(N==0) return mp[0]=0;
    if(N==1) return mp[1]=D;

    
    
    if(N<(INF+1000)/D) res=min(res,D*N);

    if(abs(N-2*(N/2))<(INF+1000)/D) res=min(res,D*abs(N-2*(N/2))+A+dfs(N/2));
    if(abs(N-2*((N+1)/2))<(INF+1000)/D) res=min(res,D*abs(N-2*((N+1)/2))+A+dfs((N+1)/2));
    if(abs(N-3*(N/3))<(INF+1000)/D) res=min(res,D*abs(N-3*(N/3))+B+dfs(N/3));
    if(abs(N-3*((N+2)/3))<(INF+1000)/D) res=min(res,D*abs(N-3*((N+2)/3))+B+dfs((N+2)/3));
    if(abs(N-5*(N/5))<(INF+1000)/D) res=min(res,D*abs(N-5*(N/5))+C+dfs(N/5));
    if(abs(N-5*((N+4)/5))<(INF+1000)/D) res=min(res,D*abs(N-5*((N+4)/5))+C+dfs((N+4)/5));
    return mp[N]=res;
}
int main(){
    int T;
    cin>>T;
    vector<ll> N(T),a(T),b(T),c(T),d(T);
    REP(i,T){
        cin>>N[i]>>a[i]>>b[i]>>c[i]>>d[i];
    }

    REP(i,T){
        mp.clear();
        A=a[i];
        B=b[i];
        C=c[i];
        D=d[i];
        
        cout<<dfs(N[i])<<endl;
    }
    
    


}

Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
long long euklid(long long a,long long b){
    while(1){
        if(b==0) break;
        a%=b;
        swap(a,b);
    }
    return a;
}
int main(){
    long long A,B;
    cin >> A >> B;
    cout << (A*B)/euklid(A,B);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  int n; cin >> n;
  ll a[100005];
  ll ans = 1;
  for(int i=0; i<n; i++) {
    cin >> a[i];  
    if(a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  
  for(int i=0; i<n; i++) {
    if(a[i] <= 1000000000000000000/ans) {
      ans = ans * a[i];
    } else {
      cout << -1 << endl;
      return 0;
    }
  }

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

Measured memory_bytes: 4428
#include<bits/stdc++.h>
#define int long long
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << x << endl
using namespace std;
int input() {
	int r;
	scanf("%lld", &r);
	return r;
}
int n, k, w[123321];
bool f(int p) {
	int w1 = 0, cnt = 0;
	for1(i, n) {
		if (w[i] > p)return 0;
		if (w1 + w[i] > p) {
			cnt++; w1 = 0;
		}
		w1 += w[i];
	}
	if (w1)cnt++;
	return cnt <= k;
}
signed main() {
	n = input(); k = input();
	for1(i, n)w[i] = input();
	int l = 0, r = 1000000000;
	while (r - l > 1) {
		int mid = (r + l) / 2;
		if (f(mid))r = mid;
		else l = mid;
	}
	puts(r);
}


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

int main(){

    while(1){
        int n;
        cin >> n;
        if(n==0){
            break;
        }
        vector<vector<int>> p(n);
        for(int i=0;i<n;i++){
            int te;
            cin >> te;
            for(int j=0;j<te;j++){
                int t;
                cin >> t;
                p[i].push_back(t);
            }
        }
        for(int i=0;i<n;i++){
            sort(p[i].begin(),p[i].end());
        }
        vector<bool> f(n,true);
        int k;
        cin >> k;
        for(int i=0;i<k;i++){
            int t;
            cin >> t;
            for(int j=0;j<n;j++){
                if(f[j]){
                    if(!binary_search(p[j].begin(),p[j].end(),t)){
                        f[j]=false;
                    }
                }
            }
        }
        int ans;
        int cnt=0;
        for(int i=0;i<n;i++){
            if(f[i]){
                ans=i+1;
                cnt++;
            }
        }
        if(cnt==1){
            cout << ans << endl;
        }else{
            cout << -1 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3120
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[200001];
int sb(int i,int j)
{
return i>j;
}
int main()
{
int n,k,i,x;
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>x;
a[x]++;
}
sort(a,a+n,sb);
x=0;
for(i=k;i<=n;i++)
x+=a[i];
cout<<x;
return 0;
}

Measured memory_bytes: 1024
// abc179_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
  int N, cnt = 0, ans = 0;
  cin >> N;
  rep(i, N) {
    int D1, D2;
    cin >> D1 >> D2;
    if (D1 == D2) cnt++;
    else cnt = 0;
    ans = max(ans, cnt);
  }

  if (ans >= 3) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3628
s = int(input())
mod = 10 ** 9 + 7

ans = 0
for l in range(1, 1000):
    ss = s - 2 * l - 1
    if ss < 0:
        continue
    comb = 1
    for i in range(l - 1):
        comb *= ss - i
        comb //= i + 1

    ans += comb
    ans %= mod

print(ans)


Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX 100005
#define mod (int)(1e18+7)
#define sp fixed<<setprecision(12)
using namespace std;

/*
vector<int> primes;
bool is_prime[MAX];
void sieve(){
    is_prime[0]=is_prime[1]=true;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=true;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(!is_prime[i]){
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=true;
            }
        }
    }
    
}

int power(int a,int n,int p){
    int res=1;
    while(n){
        if(n&1){
            res=(res*a)%p;
            n--;
        }else{
            a=(a*a)%p;
            n/=2;
        }
    }
    return res;
}
*/


int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;

    int t=1;
    //cin>>t;
    //int it=1;
    while(t--){
        int n,m,k;
        cin>>n>>m>>k;
        vector<string>  c(n);
        for(int i=0;i<n;i++){
            cin>>c[i];
        }
        int ans=0;
        for(int i=0;i<(1<<n);i++){
            for(int j=0;j<(1<<m);j++){
                int ct=0;
                for(int row=0;row<n;row++){
                    for(int col=0;col<m;col++){
                        if((((i>>row)&1)==0) and (((j>>col)&1)==0) and (c[row][col]=='#')){
                            ct++;
                        }
                    }
                }
                if(ct==k) ans++;
            }
        }
        cout<<ans<<"\n";
    }

    return 0;
    
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T &a){int t = 0;for(auto itr :a){if(t++)cout << " "; cout << itr;} cout <<endl; }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    //    std::ios_base::sync_with_stdio(false);
    //    cin.tie(NULL);
    vector<int>v(5);
    for(auto & e: v) cin >> e;
    int k; cin >> k;
    rep(i,5){
        rep(j,5){
            if(i == j)continue;
            if(abs(v[i] - v[j]) > k)return puts(":(")*0;
        }
    }
    cout << "Yay!" << endl;
}




Measured memory_bytes: 256