akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

class UFTree
{
    vector<int> parent;
    vector<int> height;
    vector<size_t> _size;

public:
    UFTree(int size)
    {
        for (int i = 0; i < size; i++)
        {
            parent.push_back(i);
            height.push_back(0);
            _size.push_back(1);
        }
    }
    int root(int node)
    {
        if (parent[node] == node)
        {
            return node;
        }
        return parent[node] = root(parent[node]);
    }
    void merge(int n0, int n1)
    {
        int r0 = root(n0), r1 = root(n1);
        if (r0 == r1)
        {
            return;
        }
        if (height[r0] < height[r1])
            swap(r0, r1);
        if (height[r0] == height[r1])
            height[r0]++;
        parent[r1] = r0;
        _size[r0] += _size[r1];
    }
    size_t size(int node)
    {
        return _size[root(node)];
    }
};

int main()
{
    int n, m;
    cin >> n >> m;

    UFTree uft(n + m);
    vector<bool> isUsed(m, false);

    rep(i, n)
    {
        int k;
        cin >> k;
        rep(j, k)
        {
            int lang;
            cin >> lang;
            uft.merge(i, n + lang - 1);
            isUsed[lang - 1] = true;
        }
    }

    int a = count(isUsed.begin(), isUsed.end(), true);
    if (uft.size(0) == n + a)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3676
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, m: usize, k: usize,
    }
    let mut board = vec![vec![0; m]; n];
    let mut cnt = 0;

    for n_ in 0..n + 1 {
        for m_ in 0..m + 1 {
            let acc = m * n_ + n * m_ - n_ * m_ * 2;
            if acc == k {
                return println!("Yes");
            }
        }
    }
    println!("No");
}


Measured memory_bytes: 8444
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n,k;
   cin >> n >> k;

   int ans = n%k;

   cout << (ans==0? "0":"1") << endl;


   return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  string s;
  cin>>s;
  if(s[0]=='7' or s[1]=='7' or s[2]=='7') cout<<"Yes"<<newl;
  else cout<<"No"<<newl;
  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
片方を決め打って２分探索

*/

ll n,m,k,a[200010],sum=0,cur=0,ans=0;
vector<ll> b;

int main(void){
	cin>>n>>m>>k;
	rep(i,n)cin>>a[i];
	b.push_back(0);
	rep(i,m){
		ll x;
		cin>>x;
		sum+=x;
		b.push_back(sum);
	}
	rep(i,n+1){
		if(cur>k)break;
		ll pos =  upper_bound(b.begin(), b.end(), k-cur) - b.begin();
		ans = max(ans, i + pos - 1);
		cur += a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6836
n, m = map(int, input().split())
s, c = [], []
for i in range(m):
    _s, _c = map(int, input().split())
    s.append(_s-1)
    c.append(_c)

for i in range(1000):
    *t, = map(int, list(str(i)))

    if len(t) != n:
        continue

    ok = True
    for j in range(m):
        if t[s[j]] != c[j]:
            ok = False
            break

    if ok:
        print(i)
        quit()

print(-1)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  int  n, p, j[1000000];
  while(scanf("%d", &n),n){
    long long len = 0, num = n;
    rep(i, n){
      scanf("%d", &p);
      len += p;
    }
    rep(i, n - 1) scanf("%d", j + i);
    sort(j, j + n-1);

    for(int i = n - 2; i >= 0; i--){
      if((num-1)*(len+j[i]) < num*len) break;
      num--;
      len+=j[i];
    }
    printf("%lld\n", num*len);
  }
  return 0;
}

Measured memory_bytes: 1304
A, B, C, D = map(int, input().split())
def gcd(x, y):
    while y != 0:
        x, y = y, x%y
    return x

def lcm(C, D):
    g = gcd(C, D)
    G = D * C // g
    return G

def num(A, C, D):
    G = lcm(C, D)
    return A - A // C - A // D + A // G

print("{}".format(num(B, C, D) - num(A-1, C, D)))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int n; cin >> n;
    vector<int> R;
    rep (i, 0, n) {
        int r; cin >> r;
        R.push_back(r);
    }

    int maxv = -INF;
    int minv = R[0];
    for (int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;
}


Measured memory_bytes: 3844
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    
    System.out.println((X - A) % B);
  }
}


Measured memory_bytes: 23124
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = H-1;
		int w = W-1;
		if(H == n) {
			h = H-1;
		}
		if(W == n) {
			w = W-1;
		}
		int ans = (n-h)*(n-w);
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <list>
using namespace std;
using ll = long long;
int main(){
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    for(int i=0; i<N; i++) cin >> P[i];

    for(int i=0; i<N; i++){
        P[i]--;
        Q[P[i]] = i;
    }

    int cnt_max = 0;
    int cnt = 1;
    for(int i=0; i<N-1; i++){
        if(Q[i+1] > Q[i]){
            cnt++;
        }else{
            if(cnt_max < cnt){
                cnt_max = cnt;
            }
            cnt = 1;
        }
    }
    if(cnt_max < cnt){
        cnt_max = cnt;
    }
    cout << N-cnt_max << endl;
    return 0;
}

Measured memory_bytes: 1792
fun main(args: Array<String>) = println(run {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }

    (1..n).map { dice ->
        var score = dice
        var rate = 1.0
        while(score < k) {
            score*=2
            rate*=0.5
        }
        rate
    }.average()
})

Measured memory_bytes: 37820
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

first = 0
second = 0
third = 0
ans = []

for i in range(len(p)):
  if p[i] <= a:
    first += 1
  elif p[i] >= a+1 and p[i] <= b:
    second += 1
  elif p[i] >= b+1:
    third += 1

ans.append(first)
ans.append(second)
ans.append(third)

print(min(ans))

Measured memory_bytes: 3064
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    ans = (n*(n+1)*(n+2))//6
    for _ in range(n-1):
        a,b = LI()
        if b < a:
            a,b = b,a
        ans -= a*(n-b+1)
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 68672
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> h(n);
  for(int i=0;i<n;i++)cin>>h[i];
  int ans=0;
  int res=0;
  for(int i=1;i<n;i++){
    if(h[i]<=h[i-1])res++;
    else res=0;
    ans=max(ans,res);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int prime[15000];
bool is_prime[150000];

void prime_judge(){
  int p=0;
  rep(i,150000)is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<150000;i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=i*2;j<=150000-1;j+=i)is_prime[j]=false;
    }
  }
  //cout<<"p: "<<p<<"  max: "<<prime[p-1]<<endl;
}

/*
int binary_search(int n){
  int l=0,r=111111;
  int i;
  while(r-l>=1){
    i=(r+l)/2;
    if(prime[i]==n)return i;
    else if(prime[i]>n) l=i+1;
    else r=i;
  }
  if(prime[i]<n)i++;
  return i;
}
*/
int straight_search(int n){
  for(int i=0;i<110000;i++){
    if(prime[i]>n)return i;
  }
  return 0;
}

void matuzaki(int n,int p){
  vi v;
  v.clear();
  int near=straight_search(n);
  //cout<<"near: "<<near<<"   prime:"<<prime[near]<<endl;
  for(int i=near;i<=near+500;i++){
    for(int j=i;j<=near+500;j++){
      v.pb(prime[i]+prime[j]);
    }
  }
  sort(all(v));
  //rep(i,p*p)cout<<i<<":  "<<v[i]<<endl;
  cout<<v[p-1]<<endl;
}

int main(){
  int n,p;
  prime_judge();
  while(cin>>n>>p){
    if(n==-1&&p==-1)break;
    matuzaki(n,p);
  }
  return 0;
}

Measured memory_bytes: 4092
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cctype>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  int a_len, b_len;

  a_len = (int)(A.length());
  b_len = (int)(B.length());

  if(A[a_len-1] == B[0] && B[b_len-1] == C[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
	int a, b;
	cin >> a >> b;
	cout << 3 - (a + b) % 3 << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

maxA = max(A)
half = maxA/2
diff = 10**10
ans = 0
for i in range(N):
    if A[i] != maxA and abs(A[i]-half) < diff:
        diff = abs(A[i]-half)
        ans = A[i]

print(maxA, ans)

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

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            string s = ReadString();
            string t = ReadString();
            bool ans = t.StartsWith(s);
            Console.WriteLine(YesNo(ans));
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

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

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static string YesNo(bool condition) => condition ? "Yes" : "No";
        static string YESNO(bool condition) => condition ? "YES" : "NO";

        #endregion
    }
}

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

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string s, t; cin >> s >> t;
	bool ok = true;
	for(int i = 0; i < s.size(); i++){
		if(s.at(i) != t.at(i)) ok = false;
	}
	if(ok) cout << "Yes" ;
	else cout << "No";
} 

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

int main(){
    int N, AC=0, WA=0, TLE=0, RE=0;
    char input[3];

    scanf("%d", &N);

    for(int i=0; i<N; i++){
        scanf("%s", input);
        if(strcmp(input, "AC") == 0){
            AC++;
        } else if(strcmp(input, "WA") == 0){
            WA++;
        } else if (strcmp(input, "TLE") == 0){
            TLE++;
        } else if (strcmp(input, "RE") == 0){
            RE++;
        }
    }
    printf("AC x %d\n", AC);
    printf("WA x %d\n", WA);
    printf("TLE x %d\n", TLE);
    printf("RE x %d\n", RE);
}

Measured memory_bytes: 1728
import java.util.ArrayList;
import java.util.Scanner;
import java.lang.Math.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		long[][] dp = new long[N + 1][W + 1];
		int[] wList = new int[N];
		long[] vList = new long[N];
		for (int i = 0; i < N; i++) {
			wList[i] = sc.nextInt();
			vList[i] = sc.nextInt();
		}
		for (int i = 0; i < W + 1; i++) {
			dp[0][i] = 0;
		}

		for (int i = 1; i < N + 1; i++) {
			for (int j = 0; j < W + 1; j++) {
				if (j - wList[i - 1] >= 0) {
					dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - wList[i - 1]] + vList[i - 1]);
				} else {
					dp[i][j] = dp[i - 1][j];
				}
			}
		}

		System.out.println(dp[N][W]);
	}

}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VI v(n), gt;
	rep(i, n) cin >>v[i];
	ll ans = 0;
	rep(l, k+1) rep(r, k-l+1){
		if(l+r > n) continue;
		gt.clear();
		rep(i, l) gt.push_back(v[i]);
		rep(i, r) gt.push_back(v[n-1-i]);
		sort(all(gt));
		ll sm = accumulate(all(gt), 0LL);
		rep(i, min(sz(gt), k-l-r)){
			if(gt[i] < 0) sm -=gt[i];
		}
		//for(auto x :gt) cerr<<x<<" "; dbg("lr",l,r,sm);
		ans = max(ans, sm);
	}
	cout <<ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int a[3];
    scanf("%d%d%d", &a[0], &a[1], &a[2]);
    sort(a, a + 3);
    if (a[2] - a[1] == a[1] - a[0]) printf("YES");
    else printf("NO");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <string>

using namespace std;
typedef long long int ll;
double logbase(double a, double base)
{
   return log(a) / log(base);
}

int main(void){
  ll n;
  cin >> n;
  n = n - 1;
  double app = logbase((25.0/26.0 * ((double)n)) + 1,26);
  int digit = ((int)app) + 1;
  ll num = 26.0/25.0*(pow(26,digit-1) - 1.0);
  ll rem = n - num;
  //cout << rem << endl;
  char a = 'a';
  ll count = 26;
  string str = "";
  
  for(int i=0;i<digit;i++){
    ll loc = rem%26;
    str = (char)(a + loc) + str;
    rem = rem - loc;
    rem = rem / 26;
  }
  cout << str << endl;
  return 0;
}

Measured memory_bytes: 4020
n, k = map(int, input().split())
h = tuple(map(int, input().split()))

INF = 10**10
dp = [INF] * n
dp[0] = 0
# dp[i] = (足場iにたどり着いた時点でのコストの最小値)

for i in range(1, n):
    dp[i] = min(dp[j] + abs(h[j] - h[i]) for j in range(max(0, i - k), i))

print(dp[n - 1])


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

#define REP(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ALL(c) c.begin(), c.end()
#define SZ(c) (int) c.size()
#define DBG1(x) cout<<#x<<" = "<<x<<"\n"
#if USE_CP_REDIR
#define CP \
    freopen("input.txt","r", stdin); \
    freopen("output.txt","w", stdout);
#endif

using ll = long long;
using pii = pair<int,int>;

const ll MOD = 1'000'000'007;
const int MN = 1'000'000;

int main()
{
ios::sync_with_stdio(false);
#ifdef CP
    CP;
#endif
    int t, n;
    string s;
    cin >> s;
    if (s.back() != 's') cout << s + 's' << endl;
    else cout << s + "es" << endl;
}

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

#define ll long long

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll n, k;
    cin >> n >> k;
    int a[n+1], pre[n+1]={}, ans=1;
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=1;i<=n;i++) {
        //cout << i << '\n';
        pre[i]++;
        if(pre[i] == 2) {
            ans = i;
            break;
        }
        i = a[i] - 1;
    }
    
    int res = 0, c = 1, t = a[ans], x=1;
    //x = a[x];
    while(x != ans) {
        res++;
        x = a[x];
    }
    x = a[x];
    while(x != ans) {
        c++;
        x = a[x];
    }    
    //cout << res << " " << c;

    if(k <= res) {
        ans = 1;
        while(k--)
            ans = a[ans];
    }
    else {
        k -= res;
        k %= c;
        ans = x;    
        while(k--)
            ans = a[ans];
    }
    cout << ans;
}

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

using namespace std;

int minimum(int A[], int n)
{
	int min = INT_MAX;
	int ind = -1;
	for(int i = 0; i < n; i++)
		if(A[i] < min)
		{
			min = A[i];
			ind = i;
		}
	return ind;
}

int main()
{
	int N, K;
	scanf("%d %d", &N, &K);
	int *arr = new int[N];
	for(int i = 0; i < N; i++)
		scanf("%d", &arr[i]);
	int ind = minimum(arr, N);
	int j = 0, res = 0;
	while(ind > j)
	{
		j += K - 1;
		res++;
	}
	int k = N - 1;
	while(j < k)
	{
		k -= K - 1;
		res++;
	}
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,k;
ll h[200010];

void solve(){
    cin >> n >> k;
    rep(i,n){
        cin >> h[i];
    }
    sort(h,h+n);
    if (k>n){
        cout << 0 << endl;
    }
    else{
        ll ans=0;
        rep(i,n-k){
            ans+=h[i];
        }
        
        cout << ans << endl;
    }
}

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

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

int main(){
    int a;
    cin >> a ;
    int count=0;

    if (a-100>=0) {count=count+1; a=a-100;}
    if (a-10>=0) {count=count+1; a=a-10;}
    if (a-1>=0) {count=count+1;}

    cout << count <<endl;
}

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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 N, K;
    cin >> N >> K;
    Vec<i32> p(N);
    for (i32 i = 0; i < N; i++) cin >> p[i];
    sort(ALL(p));
    i32 sum = 0;
    for (i32 i = 0; i < K; i++) sum += p[i];
    cout << sum << endl;
}


Measured memory_bytes: 3652
use std::io::*;
use std::str::FromStr;
use std::collections::HashSet;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: u32 = read();
    let si: Vec<String> = (0..n).map(|_| read()).collect();
    // println!("{:?}", si);
    let uniq: HashSet<String> = si.into_iter().collect();

    if uniq.len() == 3 {
        println!("Three");
    } else if uniq.len() == 4 {
        println!("Four");
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;

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

	for (ll i = 0; i < min((ll)S.size(), K); i++) {
		if (S[i] >= '2') {
			cout << S[i] << endl;
			return 0;
		}
	}

	cout << '1' << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <map>
using namespace std;
int main(void){
    
    int n,k,answer;
    cin >> n >> k;
    
    answer = 1;
    
    for(int i = 0; i < n; i++){
        if(answer > k){
            answer += k;
        }else{
            answer *= 2;
        }
    }
    
    cout << answer << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
long long INF = 1e18;
long long N, K;
std::vector<long long> a;
int main(){
    std::cin >> N >> K;
    a.resize(N);
    for(int i = 0; i < N; i++) std::cin >> a[i];
    long long ans = INF;
    for(int bit = 0; bit < (1 << N - 1); bit++){
        std::vector<int> sele(N - 1, 0);
        int count = 0;
        for(int i = 0; i < N - 1; i++){
            if(bit & (1 << i)) {
                count++;
                sele[i] = 1;
            }
        }
        if(count < K - 1) continue;
        long long res = 0;
        long long M = a[0];
        for(int i = 0; i < N - 1; i++){
            if(sele[i] == 1 && M >= a[i + 1]){
                res += M + 1 - a[i + 1];
                M++;
            }
            M = std::max(M, a[i + 1]);
        }
        ans = std::min(ans, res);
    } 
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

class UnionFind {
  vector<int> par, rank;
public:
  UnionFind(int n) {
    par.resize(n);
    for (int i = 0; i < n; i++)
      par[i] = i;
    rank.resize(n, 0);
  }
  int root(int x) {
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    if (rank[x] >= rank[y]) {
      par[y] = x;
      if (rank[x] == rank[y])
        rank[x]++;
    } else
      par[x] = y;
    return true;
  }
};

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i, m) {
    int x, y, z;
    cin >> x >> y >> z;
    --x, --y;
    uf.unite(x, y);
  }
  set<int> st;
  rep(i, n)
    st.insert(uf.root(i));
  cout << st.size() << endl;
  return 0;
}

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        long i = a / x;
        long j = b / x;
        System.out.println(a % x == 0 ? j - i + 1 : j - i);
    }
}

Measured memory_bytes: 35788
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


#define LIM 100

bool judge(vector<vector<int>> arr, vector<pii>& ps, int size) {
    for(int i = 0; i < size; i++) {
        int a = ps[i].first;
        for(int j = 0; j < size; j++) {
            int b = ps[j].second;
            if(a+b != arr[i][j]) { return 0; }
        }
    }
    return 1;
}

int main(void) {
    vector<vector<int>> arr(3, vector<int>(3));
    for(int i = 0; i < 3; i++) {
        cins(arr[i]);
    }

    vector<pii> pairs(3);
    int flag = 0;
    for(int a1 = -LIM; a1 <= LIM; a1++) {
        pairs[0] = make_pair(a1, arr[0][0] - a1);
        for(int a2 = -LIM; a2 <= LIM; a2++) {
            pairs[1] = make_pair(a2, arr[1][1]-a2);
            for(int a3 = -LIM; a3 <= LIM; a3++) {
                pairs[2] = make_pair(a3, arr[2][2]-a3);
                if(judge(arr, pairs, 3)) {
                    flag = 1;
                    goto finish;
                }
            }
        }
    }
finish:
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3604
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const ll MOD = TEN(9) + 7;
int n, k;
vl non_neg, neg, a;

int main() {
    fastio();

    cin >> n >> k;

    forn(i, n) {
        ll x;
        cin >> x;
        if (x >= 0) {
            non_neg.push_back(x);
        } else if (x < 0) {
            neg.push_back(-x);
        }

        a.push_back(x);
    }

    if (k == n) {
        ll ans = 1;
        for (auto x : a) {
            ans = ans * abs(x) % MOD;
        }
        if (neg.size() % 2 == 1) {
            ans = (MOD - ans) % MOD;
        }
        cout << ans << endl;
        return 0;
    }

    sort(all(non_neg));
    sort(all(neg));

    ll ans = 1;
    if (neg.size() == n and k % 2) {
        for (int i = 0; i < k; i++) {
            ans = ans * neg[i] % MOD;
        }
        ans = (MOD - ans) % MOD;

        cout << ans << endl;
    } else {
        reverse(all(non_neg));
        reverse(all(neg));
        int c = 0;
        int i = 0, j = 0;

        while (c < k) {

            if (c + 1 == k or j >= int(neg.size()) - 1 or (i < int(non_neg.size()) - 1 and non_neg[i] * non_neg[i + 1] >= neg[j] * neg[j + 1])) {
                ans = ans * non_neg[i] % MOD;
                i++;
                c++;
            } else {
                ans = ans * neg[j] % MOD * neg[j + 1] % MOD;
                j += 2;
                c += 2;
            }
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 7484
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

combi = []
for i in range(n):
    l = i
    r = n - i - 1
    combi.append(abs(l - r))

if sorted(combi) == sorted(a):
    c = Counter(combi)
    ans = 1
    for i in c.values():
        ans *= i
        ans %= mod
else:
    ans = 0

print(ans)


Measured memory_bytes: 17604
#include <bits/stdc++.h>
#ifdef IS_MY_ENV
#include <tourist>
#endif
using namespace std;

int dp[100100];
int h[100100];

signed main() {

    memset(dp, 0x3f, sizeof(dp));

    int n, k;
    cin >> n >> k;
    for ( int i = 1; i <= n; i++ ) {
        cin >> h[i];
    }

    dp[1] = 0;
    for ( int i = 1; i <= n; i++ ) {
        for ( int j = 1; j <= k; j++ ) {
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
        }
    }

    cout << dp[n] << endl;

    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d);
    return 0;
}


Measured memory_bytes: 256
import sys


class Graph:
    def __init__(self, nodes={}):
        self.nodes = nodes


n = int(input())
G = Graph()
for line in sys.stdin:
    numList = list(map(int, line.split()))
    G.nodes[numList[0]] = list(numList[2:])
for node in range(n):
    out = ''
    for adj in range(n):
        if adj + 1 != n:
            out += '1 ' if adj + 1 in G.nodes[node + 1] else '0 '
        else:
            out += '1' if adj + 1 in G.nodes[node + 1] else '0'
    print(out)

Measured memory_bytes: 7764
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        String S;
        S = sc.next();

        final Solver solver = new Solver();
        solver.solve(S);
    }
}

class Solver {
    static final String YES = "Yes";
    static final String NO = "No";

    public void solve(String S) {
        if (S.length() % 2 != 0) {
            System.out.println(NO);
            return;
        }

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (i % 2 == 0 && c != 'h') {
                System.out.println(NO);
                return;
            }
            if (i % 2 != 0 && c != 'i') {
                System.out.println(NO);
                return;
            }
        }
        System.out.println(YES);
    }
}



Measured memory_bytes: 21844
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn modpow(a: usize, n: usize, p: usize) -> usize {
    let mut base = a;
    let mut acc = 1;
    let mut exp = n;

    while exp > 0 {
        if (exp & 1) == 1 {
            acc = acc * base % p;
        }
        exp /= 2;
        base = base * base % p;
    }

    acc
}

fn hate_com(a: usize, n: usize, p: usize) -> usize {
    let (mut x, mut y) = (1, 1);
    for i in 0..a {
        x = (n - i) * x % p;
        y = y * (a - i) % p;
    }
    x * modpow(y, p - 2, p) % p
}

fn main() {
    input!(
    n: usize,
    a: usize,
    b: usize,
    );
    let p: usize = 1000000007;
    let sum:usize = modpow(2, n, p) - 1 % p;
    let ac:usize = hate_com(a, n, p);
    let bc:usize = hate_com(b, n, p);
    let mut ans = sum as i64 - ac as i64 - bc as i64;
    let ans = if ans < 0 { while ans < 0 {ans += p as i64;} ans} else { ans };

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


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

int main(){
  char s[200002];  scanf("%s", s);
  long long int ans = 0, count = 0;
  for(int i=0; i<strlen(s); i++)
    if(s[i] == 'W')
      ans = ans + (long long int)i - (++count - 1);
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
#define ll  long long int
#define mod 1000000007
using namespace std;
	vector<ll> g[200001];
	ll vi[200001];
ll ans=0;
ll aa1=1;
vector<ll> aa[200001];
void dfs(ll s,ll c)
{
//	cout<<s<<" "<<c<<endl;
	ans=max(ans,aa1);
	
	vi[s]++;
	for(int i=0;i<g[s].size();i++)
	{
		if(vi[g[s][i]]==0)
		{
			aa[s].push_back(g[s][i]);
			aa1++;
			dfs(g[s][i],c+1);		
		}
	}	
}	
	
main()
{
	ll n,k;
	cin>>n>>k;
	map<pair<ll,ll> ,ll> m;
	for(ll i=0;i<n;i++)
		{
		g[i].clear();
		vi[i]=0;	
		}
	for(ll i=0;i<k;i++)
	{
		ll a[2];
		cin>>a[0]>>a[1];
		sort(a,a+2);
		if(m[{a[0],a[1]}]==0)
		{
			m[{a[0],a[1]}]++;
			g[a[0]].push_back(a[1]);	
			g[a[1]].push_back(a[0]);
		}
		
	}
	
	for(ll i=1;i<=n;i++)
	{
		if(vi[i]==0)
		{
			aa1=1;
			dfs(i,1);
		}
	}
//	for(ll i=1;i<=n;i++)
//	{
//		ans=max((ll)ans,(ll)aa[i]);
//	}
	cout<<ans<<endl;		
		
}

Measured memory_bytes: 55108
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

void chmax(int &a, int b) { a = max(a, b); }

int INF = 1e+15;
int n;
int a[3];
int b[3];
int dp[25100001];

int solve(int n, int a[], int b[]) {
	int i, j;
	
	rep(i, n + 1) dp[i] = -INF;
	dp[0] = 0;
	
	rep(i, n) {
		rep(j, 3) {
			chmax(dp[i + a[j]], dp[i] + b[j]);
		}
	}
	
	int ret = 0;
	rep(i, n + 1) {
		int score = n - i + dp[i];
		ret = max(ret, score);
	}
	return ret;
}

signed main() {
	int i, j;
	
	cin >> n;
	rep(i, 3) cin >> a[i];
	rep(i, 3) cin >> b[i];
	
	n = solve(n, a, b);
	n = solve(n, b, a);
	cout << n << endl;
	return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int x, y; std::cin >> x >> y;
    bool ok = false;
    rep(a, x+1) {
        int b = x-a;
        if (a*2 + b*4 == y) ok = true;
    }
    std::cout << (ok ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	string str;
	cin>>str;
	//VL ct(26,0);
	ll ct=0;
	fr(i,0,SZ(str)/2)
	{
		if(str[i]!=str[SZ(str)-i-1])
			ct++;
	}
	wl(ct);
	NL;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int I=X;I<Y;I++)
#define REP(I,X,Y) for(int I=Y-1;I>=X;I--)
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

ll adj[100][100];

int main(){
  FOR(i,0,100)FOR(j,0,100)adj[i][j] = LINF;
  FOR(i,0,100)adj[i][i] = 0;
  ll V,E,s,t,d;
  cin >> V >> E;
  FOR(i,0,E){
    cin >> s >> t >> d;
    adj[s][t] = d;
  }
  FOR(i,0,V)FOR(j,0,V)FOR(k,0,V)if(adj[j][i] != LINF && adj[i][k] != LINF)adj[j][k] = min(adj[j][k],adj[j][i]+adj[i][k]);
  FOR(i,0,V)FOR(j,0,V)FOR(k,0,V){
    if(adj[j][i] != LINF && adj[i][k] != LINF)if(adj[j][k] > adj[j][i]+adj[i][k]){
      puts("NEGATIVE CYCLE");
      return 0;
    }
  }
  FOR(i,0,V){
    FOR(j,0,V)cout << (adj[i][j] == LINF ? "INF" :to_string(adj[i][j])) << (j != V-1 ? " " : "");cout << endl;
  }
}



Measured memory_bytes: 3344
fun main(args: Array<String>){
  val (a,b) = readLine()!!.split(' ').map{it.toLong()}
  println(a/gcd(a,b)*b)
}

fun gcd(a: Long, b: Long) : Long{
  when(b){
   	0L -> return a
    else -> return gcd(b, a%b)
  }
}


Measured memory_bytes: 36412