akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Triangle | diff Triangle.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Triangle.cpp && ./a.out

/*
 
 7/21/2019
 
 5:00-6:06 give up
 6:50-7:08 AC
 
 I tried to construct S by a*(a+x)-1*y where 0<=x<=1
 However 1e9*a-1*b in the editorial is even simpler!
 
 https://img.atcoder.jp/agc036/editorial.pdf
 
 */

LL S;

LL isqrt(LL x) {
  assert(x>0);
  LL y=(LL)(sqrtl((long double) x)+0.5);
//  while(y*y<x) ++y;
//  while(y*y>x) --y;
  return y;
}

void pr(LL a, LL b, LL c, LL d) {
  assert(a<=1e9&&b<=1e9&&c<=1e9&&d<=1e9);
  assert(a*d-b*c==S);
  println("%lld %lld %lld %lld %lld %lld", 0LL,0LL,a,b,c,d);
}
void solve() {
  LL a=1e9;
  LL d=(S+a-1)/a;
//  dump(a,d,a*d);
  assert(a*d>=S);
  LL c=a*d-S;
  pr(a,1,c,d);
}

void solve_org() {
  LL a=isqrt(S);
  dump(a,a*a,S);
  LL d=a;
  while(a*d<S) ++d;
  if(a*d==S) {
    pr(a,0,0,d);
    return;
  }
  dump(a,d,a*d,S);
  LL bc=a*d-S;
  pr(a,bc,1,d);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>S;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n;
    cin >> n;
    if(n >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3592
import scala.io.StdIn._

import Math._
object Main extends App {
  val eps0 = 1e-12

  val q = readLine.toInt
  for (i <- 0 until q) {
    val Seq(xp0, yp0, xp1, yp1, xp2, yp2, xp3, yp3) = readLine.split(' ').map(_.toDouble).toList
    val sx1 = xp1 - xp0
    val sy1 = yp1 - yp0
    val sx2 = xp3 - xp2
    val sy2 = yp3 - yp2

    val rot = sx1 * sy2 - sy1 * sx2
    val dot = sx1 * sx2 + sy1 * sy2

    println(if (rot.abs < eps0) "2" else if (dot.abs < eps0) "1" else "0")
  }
}



Measured memory_bytes: 52120
#include<bits/stdc++.h>
using namespace std;
#define IOS cin.tie(NULL);iosbase::sync_with_stdio(false);
#define pb push_back
int n,x,y,ans[10000],dis;

int32_t main(){
    cin>>n>>x>>y;
    for(int i=1;i<=n;i++){  
        for(int j=i+1;j<=n;j++){
            dis = min(abs(i-j),min(abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(x-j)));
            ans[dis]++;
        }
    }
    for(int i=1;i<n;i++){
        printf("%d\n",ans[i]);
    }

}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int q = in.nextInt(), h = in.nextInt(), s = in.nextInt(), d = in.nextInt();
            h = Math.min(h, q * 2);
            s = Math.min(s, h * 2);
            d = Math.min(d, s * 2);
            int n = in.nextInt();
            out.println((long) n / 2 * d + (long) (n % 2) * s);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23508
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}

int main(void){
    int i,j,n,m,t,k,a[262144],r=0,l;
    double d;
    char s[262144];
    scanf("%d%d",&n,&k);
    //l=strlen(s);
    //for(i=1;i<=n;i++){scanf("%d",&a[i]);}
    //printf("%d\n",r);
    if((n*k)%2){printf("Odd\n");}else{printf("Even\n");}
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}

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


///////////////////////////////////////////////////////////////////////////////////
int main() {

    int n;
    string c;
    cin >> n;
    cin >> c;
    int r = 0;
    for (int i = 0;i < n;i++){
        if (c[i] == 'R') r++;
    }

    int ans = 0;
    for (int i = 0;i < r;i++){
        if (c[i] == 'W') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3756
#include <iostream>

using namespace std;

int main() {
	bool cards[4][14];
	int i, j;
	for (i = 0;i <= 3;i++) {
		for (j = 1;j <= 13;j++)
			cards[i][j] = 0;
	}
	int n;
	char a;
	int b;
	cin >> n;
	for (i = 0;i < n;i++) {
		cin >> a >> b;
		if (a == 'S')cards[0][b] = 1;
		if (a == 'H')cards[1][b] = 1;
		if (a == 'C')cards[2][b] = 1;
		if (a == 'D')cards[3][b] = 1;
	}


	for (i = 0;i <= 3;i++) {
		for (j = 1;j <= 13;j++) {
			if (cards[i][j] == 0) {
				switch (i) {
				case 0:cout << "S " << j << endl;break;
				case 1:cout << "H " << j << endl;break;
				case 2:cout << "C " << j << endl;break;
				case 3:cout << "D " << j << endl;break;
				}
			}
		}
	}
}


Measured memory_bytes: 3088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N<=1000) {
			System.out.println(1000-N);
		}
		if(1000< N && N<=2000) {
			System.out.println(2000-N);
		}
		if(N>2000 && N<=3000) {
			System.out.println(3000-N);
		}
		if(N>3000 && N<=4000) {
			System.out.println(4000-N);
		}
		if(N>4000 && N<=5000) {
			System.out.println(5000-N);
		}
		if(N>5000 && N<=6000) {
			System.out.println(6000-N);
		}
		if(N>6000 && N<=7000) {
			System.out.println(7000-N);
		}
		if(N>7000 && N<=8000) {
			System.out.println(8000-N);
		}
		if(N>8000 && N<=9000) {
			System.out.println(9000-N);
		}
		if(N>9000 && N<=10000) {
			System.out.println(10000-N);
		}

	}
}

Measured memory_bytes: 35760
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;


int main(){
  int N;
  cin >> N;
  vector<int> S(5,0);
  for(int i=0; i<N; i++){
    string s;
    cin >> s;
    if(s[0] == 'M'){
      S[0]++;
    }
    if(s[0] == 'A'){
      S[1]++;
    }
    if(s[0] == 'R'){
      S[2]++;
    }
    if(s[0] == 'C'){
      S[3]++;
    }
    if(s[0] == 'H'){
      S[4]++;
    }
  }
  ll sum=0;
  for(int bit=0; bit<(1<<5); bit++){
    if(__builtin_popcount(bit) != 3){
      continue;
    }
    ll p=1;
    for(int i=0; i<5; i++){
      if(bit&(1<<i)){
        p *= S[i];
      }
    }
    sum += p;
  }
  cout << sum << endl;
  return 0;
}


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

int a, b;

int main() {
    cin >> a >> b;

    if (a <= 0 && 0 <= b) cout << "Zero" << endl;
    else if (0 < a && 0 < b) cout << "Positive" << endl;
    else cout << (((b-a)%2==0) ? "Negative" : "Positive") << endl; 
    

    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var S = ReadLine();

        var date = DateTime.Parse(S);

        var ans = date < DateTime.Parse("2019/05/01") ? "Heisei" : "TBD";

        WriteLine(ans);
    }
}


Measured memory_bytes: 28804
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ai = [(a, i) for i, a in enumerate(A)]
    ai.sort()
    ans = 0
    for i, (a, j) in enumerate(ai):
        if i % 2 != j % 2:
            ans += 1
    return ans // 2


def main():
    N = read_int()
    A = [read_int() for _ in range(N)]
    print(slv(N, A))


if __name__ == '__main__':
    main()


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

int main(){
    int n;
    string a, b, c;
    int cnt = 0;
    cin >> n >> a >> b >> c;
    for(int i = 0; i < n; i++){
        if(a[i] == b[i] && b[i] == c[i]) continue;
        if(a[i] == b[i] && a[i] != c[i] && b[i] != c[i]) cnt++;
        else if(a[i] == c[i] && a[i] != b[i] && b[i] != c[i]) cnt++;
        else if(c[i] == b[i] && a[i] != c[i] && a[i] != b[i]) cnt++;
        else cnt += 2;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
ps = gets.split.map(&:to_i)
i = 1
len = ps.length
cnt = 0
while(i < len - 1) do
  cnt += 1 if [ps[i], ps[i+1], ps[i-1]].sort[1] == ps[i]
  i+=1
end
puts cnt

Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define REP(i,n) for(i=0;i<n;i++)

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);
double to_deg(double rad);

//main function
int main() {
    int N = iin(), i, h = N / 2;
    char s[N];
    stin(s);

    if (N % 2 == 1) {
        stout("No");
        return 0;
    }
    REP(i, h) {
        if (s[i] != s[i + h]) {
            stout("No");
            return 0;
        }
    }

    stout("Yes");

    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

/*
    int型の最大公約数
*/

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    int型の最小公倍数
*/

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    long long型の最大公約数
*/

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    long long型の最小公倍数
*/

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    int型の昇順用比較関数
*/

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

/*
    int型の降順用比較関数
*/

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

/*
    弧度法を度数法に
*/

double to_deg(double rad) {
    return rad * 180.0 / (atan(1.0) * 4.0);
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<cctype>
#include<string>
#include<cmath>
using namespace std;

int main() {
	int N,v,j;
	int A[1000];
	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int a = 0; a < N; a++) {
			cout << A[a];
			if (a < N - 1) {
				cout << ' ';
			}
			else {
				cout<<endl;
			}
		}
	for (int i = 1; i < N; i++) {
		v = A[i];
		j = i-1 ;
		while (j >= 0 && v < A[j]) {

			A[j + 1] = A[j];
			j--;
         A[j+1] = v;
		}
		
		for (int a = 0; a < N; a++) {
			cout << A[a];
			if (a < N - 1) {
				cout << ' ';
			}
			else {
				cout<<endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1000000
using namespace std;
int main()
{
    int n;
    char c;
    string s;
    cin >> n;
    rep(i, n)
    {
        cin >> c;
        s += c;
    }
    rep(i, 10000)
    {
        if (s.find(to_string(i)) == -1)
        {
            cout << i << endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3280
#include<bits/stdc++.h>
    #define ll          long long
    #define pb          push_back
    #define eb          emplace_back
    #define c(P)        cout<<P<<"\n"
    #define pii         pair<ll,ll>
    #define mi          map<ll,ll>
    #define mii         map<pii,ll>
    #define mp(x,y)     make_pair(x,y) 
    #define exit(x)     cout<<x<<"\n",return
    #define mem(a,val)  memset(a,val,sizeof(a))
    #define fr(i,a,n)   for(ll i=a;i<n;i++)
    #define frr(i,a,n)  for(ll i=n-1;i>=a;i--)
    const ll N=5000005;
    const ll mod = 1e12 + 7;
    ll dp[N],a[N];
      ll n,k;
    using namespace std;
    ll fun(ll n)
    {
    if(n<=1)
      return 0;
    if(dp[n]!=mod)
      return dp[n];
    if(n==2)
    {
      return abs(a[2] - a[1]);
    }
    if(n==3)
    {    if(k>1)
      return min(abs(a[3] - a[1]),abs(a[2] - a[1]) + abs(a[3] - a[2]));
      else return (abs(a[2] - a[1]) + abs(a[3] - a[2]));
    }
     
    ll mn = mod;
     for (int i = 1; i <= k; ++i)
     {
      if(n-i>0)
      {
       mn = min( mn , abs(a[n] - a[n - i]) + fun( n - i ));
     
      }
      else break;
     }
     return dp[n] = mn;
    }
    void solve()
    {
      ll T=1;
      //cin>>T;
      while(T--)
      {
     // string s;
      cin>>n>>k;
      for (ll i = 1; i <= n; ++i)
      {
      cin>>a[i];
      dp[i] = mod;
      }
      ll x = fun(n); 
    cout<<x;
     
     }
    }
     
    signed main(){

            ios_base::sync_with_stdio(false);   
            cin.tie(NULL);
           solve();
        return 0;
        }

Measured memory_bytes: 7808
N = int(input())
a = [int(input()) for _ in range(N)]

cnt = 0
adr = 0

for i in range(N):
    if a[adr] == 2:
        cnt += 1
        break
    adr = a[adr] - 1
    cnt += 1
else:
    cnt = -1

print(cnt)

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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<string> w;
  string a;
  for(int i = 0; i < N; i++){
    a += 'a';
  }
  vector<char> c(N, 'a');
  for(;a[0] == 'a';){
    w.push_back(a);
    cout << a << endl;
    a[N - 1]++;
    for(int j = N - 1; j > 0; j--){
      if(a[j] > c[j] + 1 || a[j] > 'a' + j){
        a[j] = 'a';
        a[j - 1]++;
      }
    }
    for(int i = 1; i < N; i++){
      c[i] = max(a[i - 1], c[i - 1]);
    }
  }
  
  
  return 0;
}

Measured memory_bytes: 7796
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <queue>
#include <string.h>

int main(int argc, char *argv[])
{
	int n,x,y;

	cin>>n>>x>>y;
	
	if (x>y) {int t=x;x=y;y=t;}
	vector<int> l(n,0); 

	for (int i=1;i<=n;i++)
	{
		int ix=abs(x-i);
		int iy=abs(y-i);
		for (int j=i+1;j<=n;j++)
		{
			int jx=abs(x-j);
			int jy=abs(y-j);
			int a=j-i;
			int b=ix+jx; a=min(a,b);
			b=ix+1+jy; a=min(a,b);
			b=iy+1+jx; a=min(a,b);
			b=iy+jy; a=min(a,b);
			l[a]++;
		}
	}
	for (int i=1;i<n;i++) cout<<l[i]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
int A[32], N;
int main(){
	A[0] = 1;
	for (int i=1; i<=31; i++){
		A[i] = A[i-1];
		if (i>1) A[i] += A[i-2];
		if (i>2) A[i] += A[i-3];
	}
	while (cin >> N && N!=0){
		int year = A[N]/3650+1;
		cout << year << endl;
	}
}

Measured memory_bytes: 3032
#include <iostream>
int main() {
    int r,c;
    scanf("%d%d", &r, &c);
    int a[r+1][c+1];
    for (int i=0; i<c+1; i++) a[r][i]=0;
    for (int i=0; i<r; i++) {
        int s=0;
        for (int j=0; j<c; j++) {
            scanf("%d", &a[i][j]);
            s+=a[i][j];
            a[r][j]+=a[i][j];
        }
        a[i][c]=s;
        a[r][c]+=s;
    }
    for (int i=0; i<r+1; i++) {
        printf("%d", a[i][0]);
        for (int j=1; j<c+1; j++) printf(" %d", a[i][j]);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 3188
#include<cstdio>
using namespace std;

int main(){
    int a,b,c,d;
    int s1,s2;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    s1 = a*b;
    s2 = c*d;
    if(s1>s2)
        printf("%d\n",s1);
    else
        printf("%d\n",s2);
    
    return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main () {
  int n;
  while (cin >> n, n) {
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    int min_ = 1e+9;
    for (int i = 0; i < n - 1; i++) {
      min_ = min(min_, v[i + 1] - v[i]);
    }
    cout << min_ << endl;
  }
  
  return 0;
  
}

Measured memory_bytes: 3140
#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;

#define MAX_N 100

int nums[MAX_N];
int n;

void solve(){
  bool res=true;
  REP(i,n){
    if(nums[i]%2==0){
      if(!(nums[i]%3==0||nums[i]%5==0)){
        res=false;
      }
    }
  }
  if(res) printf("APPROVED\n");
  else printf("DENIED\n");
}

int main()
{
  cin >> n;
  REP(i,n){
    cin >> nums[i];
  }
  solve();
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math

n, k = map(int, input().split())

output = 0
for i in range(1, n+1):
    if i >= k:
        output += 1/n
    else:
        num = math.ceil(math.log2(k/i))
        output += 1/n * ((1 / 2)**num)

print(output)

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 1010;

int a, b, w;

int main()
{
    cin >> w >> a >> b;
    if(a > b) swap(a, b);

    cout << max(0, b - (a + w)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	int n,k;
	cin >> n >> k;
	ll acc[n+1], accback[n+1];
	for(int i=0; i<=n; i++) {
		if(i==0) acc[i] = 0;
		else acc[i] = acc[i-1] + i;
	}
	for(int i=0; i<=n; i++) {
		if(i==0) accback[i] = n;
		else accback[i] = accback[i-1] + (n-i);
	}
	ll ans = 0;
	for(int i=k; i<=n+1; i++) {
		ll temp2 = accback[i-1] - acc[i-1] + 1;
		ans += temp2;
		ans %= MOD;
	}
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6712
#include<iostream> 
using namespace std;
typedef long long ll;
int a[5];

int main()
{
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
	for(int i=0;i<5;i++){
		if(a[i]==0){
			cout<<i+1;
			break;
		}
	} 
	return 0;	
} 

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int MOD = 1e8;
int main() {
    IO;
     int a ,b ,c  ;
     cin>>a>>b>>c ;
     if(b*c>=a){
         cout<<"Yes"<<endl;
     } else{
         cout<<"No"<<endl;
     }
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
void solve()
{ string s;
    int t,c1=0,c2=0,c3=0,c4=0;
   cin>>t;
   for(int i=0;i<t;i++)
   {cin>>s;
  if(s=="AC")
  c1++;
else if(s=="WA")
   c2++;
else if(s=="TLE")
  c3++;
else if(s=="RE")
  c4++;
}
  cout<<"AC x "<<c1<<"\n";
  cout<<"WA x "<<c2<<"\n";
  cout<<"TLE x "<<c3<<"\n";
  cout<<"RE x "<<c4<<"\n";



   
 } 
     

  
  
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(NULL);
   #ifdef Pranab
   freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
   #endif  
 
   int t=1; 
   //cin>>t;
 
   while(t--)
   {solve();cout<<"\n";}

   cerr<<"\n"<<(float)clock()/CLOCKS_PER_SEC*1000<<" ms"<<endl;

   return 0;
}

Measured memory_bytes: 3816
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <set>
using namespace std;

vector<vector<int>> G,GG;
vector<bool> seen;
vector<long long> a;
vector<long long> b;

void dfs(int u){
  seen[u]=true;
  for(int v:G[u]){
    if(!seen[v]){
      GG[u].push_back(v);
      dfs(v);
    }
  }
}

bool res;

long long dfs2(int v){
  if(GG[v].size()==0){
    b[v]=a[v];
    return b[v];
  }
  vector<long long> kk;
  for(int u:GG[v]){
    kk.push_back(dfs2(u));
  }
  long long tmp=0;
  for(long long t:kk)tmp+=t;
  // if(tmp<a[v])res=false;
  long long pr=tmp-a[v];
  int si=kk.size();
  // if(si>1){
  //   sort(kk.begin(),kk.end());
  //   while(pr>0&&kk[si-2]>0){
  //     long long di = min(kk[si-2],pr);
  //     di=max(1ll,di/2);
  //     kk[si-2]-=di;
  //     kk[si-1]-=di;
  //     pr-=di;
  //     sort(kk.begin(),kk.end());
  //   }
  // }
  b[v]=2*a[v]-tmp;
  if(b[v]<0)res=false;
  for(long long k:kk){
    if(2*k>2*a[v])res=false;
  }
  if(2*b[v]>2*a[v])res=false;
  // if(pr>0)res=false;
  return b[v];
}

int main(int argc, char const *argv[]) {
  long long n;cin>>n;
  a = vector<long long>(n);
  b = vector<long long>(n);
  for(int i=0;i<n;++i)cin>>a[i];
  G=vector<vector<int>>(n);
  GG=vector<vector<int>>(n);
  for(int i=0;i<n-1;++i){
    int u,v;cin>>u>>v;
    u--;v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  seen=vector<bool>(n);
  res = true;
  int s=0;
  while(G[s].size()>1)s++;
  dfs(s);
  dfs2(s);
  if(b[s]!=a[s])res=false;
  if(res)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;



  return 0;
}


Measured memory_bytes: 20608
//shara's here
//私は大きな男の子
//SPEEEEEEEEEED IS KEEEEEEEEEEY
//REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
#include <bits/stdc++.h>
using namespace std;
//fold
typedef string s;
typedef long long ll;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
	speed;
	s ss,dd;
	cin>>ss>>dd;
	ll n=(ll)ss.size(),d=(ll)dd.size();
	bool ok=false;
	if(n>d){cout<<"GREATER"<<endl; ok=true;}
	else if(n<d){cout<<"LESS"<<endl;ok=true;}
	if(ok)return 0;
	else{
	if(ss>dd)cout<<"GREATER"<<endl;
	else if(ss<dd)cout<<"LESS"<<endl;
	else cout<<"EQUAL"<<endl;
}
	
	
	
	
	
	
	
	
	





return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
using namespace std;
long long A,B,gasit,p,st1,st2,dr1,dr2,tot,care;
int main()
{
   // freopen("data.in","r",stdin);
    cin>>A>>B;gasit=-1;
    if(A==B)
    {
        cout<<1;
        return 0;
    }
    for(long long p=60;p>=0&&gasit==-1;p--)
        if(((A^B)&(1LL<<p)))
            gasit=p;
    A&=((1LL<<gasit)-1);
    B&=((1LL<<gasit)-1);
    tot=(1LL<<gasit)-A;
    st1=(1LL<<gasit);care=-1;
    for(p=0;p<=60;p++)
        if(((1LL<<p)&B))
          care=p;
    if(care>=0)dr1=st1+(1LL<<(care+1))-1;
    else dr1=st1;
    st2=st1+A;dr2=(1LL<<(gasit+1))-1;
    tot+=1LL*dr2-st2+1+dr1-st1+1;
    if(max(st1,st2)<=min(dr1,dr2))
        tot-=(1LL*min(dr1,dr2)-max(st1,st2)+1);
    cout<<tot<<'\n';
    return 0;
}

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

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

  string s;
  cin >> s;
  int n = s.size();
  string res;
  for(int i =0; i < n;i++) {
    res+='x';
  }
  cout << res << endl;
}


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

#define ll long long int
#define str string

ll MOD = 1000000007,INFL = 1ll << 60,INF = 1 << 30;
pair <ll, ll> A[10000000] = {}, X[1000000] = {};
int dy[]={0, 0, 1, -1},dx[]={1, -1, 0, 0};
vector <ll> v;
ll a = 0,m = 0,c = 0,n = 0,sum = 0, max = INF;
str S;
int ans = 0;

int findDigits(int n) {
        int i = 0;
        while (n > 0) {

                sum += n%10;
                n /= 10;
                i++;
        }
        return i;
}


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

cin >> S;
if(S[0] == 'T')cout << "A" << endl;
if(S[0] == 'A')cout << "T" << endl;
if(S[0] == 'G')cout << "C" << endl;
if(S[0] == 'C')cout << "G" << endl;

  //Code Line
        return 0;
}


Measured memory_bytes: 172160
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;

signed main(){
    int n;
    cin >> n;
    int a[10010];
    int b[10010];
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    int c[2010];
    rep(i,n) c[i] = b[i] - a[i];
    int cnt = 0;
    rep(i,n){
        cnt += c[i];
    }
    if(cnt < 0){
        cout << "No" << endl;
        return 0;
    }
    int cnt1 = cnt;
    int cnt2 = cnt;
    rep(i,n){
        if(c[i] > 0){
            cnt1 -= c[i]/2 + c[i]%2;
            c[i] = -1*(c[i]%2);
        }
    }
    rep(i,n){
        if(c[i] < 0){
            cnt2 -= -1*c[i];
            c[i] = 0;
        }
    }
    if(cnt1*2 == cnt2 && cnt1 >= 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    cerr << cnt << " " << cnt1 << " " << cnt2 << endl;



    

    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>

using namespace std;

int main()
{
  vector<tuple<int, int, int>> vs;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
	int t, x, y;
	cin >> t >> x >> y;
	vs.push_back(make_tuple(t, x, y));
  }
  sort(vs.begin(), vs.end());

  bool success = true;
  int t = 0, x = 0, y = 0;
  for (auto v : vs)
  {
	int nt, nx, ny;
	tie(nt, nx, ny) = v;

	int time_to_go = abs(nx - x) + abs(ny - y);
	int rest_time = nt - t;
	if (rest_time < time_to_go || (rest_time - time_to_go) % 2 == 1)
	{
	  success = false;
	}
  }
  if (success)
  {
	cout << "Yes" << endl;
  }
  else
  {
	cout << "No" << endl;
  }
}  


Measured memory_bytes: 1912
N,HP = map(int,input().split())
L = list(list(map(int,input().split())) for i in range(N))

L = sorted(L, key=lambda x: x[0], reverse=True)
max_a = L[0][0]
L = sorted(L, key=lambda x: x[1], reverse=True)

ans = 0

for i in range(N) :
    if L[i][1] < max_a :
        break
    HP -= L[i][1]
    ans += 1
    if HP <= 0 :
        break

if HP >= 0 :
    if HP % max_a == 0 :
        ans += HP//max_a
    else :
        ans += HP//max_a + 1

print(ans)


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

int main() {
    long long n;
    cin >> n;
//vector<型> 配列名(要素数, 初期値);
    vector<long long> a(n,0);
    for (long long i = 0; i < (n); ++i) {
        cin >> a.at(i);
    }
    long long min = *min_element(a.begin(), a.end());
    long long max = *max_element(a.begin(), a.end());

//std::accumulate(開始位置, 終了位置, 初期値);
//初期値をロングロング型に
    long long sum = accumulate(a.begin(), a.end(), 0LL);
    cout  << min << " " << max << " " << sum << endl;

    return 0;
}


Measured memory_bytes: 3172
{-# LANGUAGE
    BangPatterns, MultiWayIf, TupleSections #-}
{-# OPTIONS_GHC -O2 #-}


import Control.Arrow
import Control.Concurrent
import Control.Monad
import Data.Bits
import qualified Data.ByteString.Builder as B
import qualified Data.ByteString.Char8 as C
import Data.Char
import Data.Complex
import Data.Function
import Data.Function.HT
import qualified Data.IntMap.Strict as IM
import qualified Data.IntSet as IS
import Data.List
import Data.Maybe
import Data.Monoid
import Data.Ord
import qualified Data.Sequence as Sq
import Data.Vector.Algorithms.Search
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import Debug.Trace
import System.IO


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


main :: IO ()
main = do
    k <- readLn
    let start = 7 `mod` k
    -- print start
    let lst   = take k $ iterate (\x -> (x * 10 + 7) `mod` k ) start
    -- print $ take 10 lst
    let r = (+1) <$> findIndex (\x -> x == 0) lst
    -- print r
    print $ fromMaybe (-1) r


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    string S;
    cin >> S;
    if (S == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    ll A,B;
    cin >> A >> B;
    ll an = 0;
    for (ll i = 1; i <= max(A,B); i++) if(A%i == 0 && B%i == 0) an = i;
    
    A = A/an;
    B = B/an;
    
    cout << A*B*an << endl;
    
    



    return 0;
}


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

#define INF INT_MAX/2;
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long ;

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

   int N,M;
   cin>>N>>M;
   vector<int>a(M),b(M);
   for(int i=0;i<M;i++)cin>>a[i]>>b[i];
   set<int>s;
   for(int i=0;i<M;i++){
      if(a[i]==N)s.insert(b[i]);
      if(b[i]==N)s.insert(a[i]);
   }
   for(int i=0;i<M;i++){
      if(a[i]==1){
         auto it = s.find(b[i]);
         if(it != s.end()){
            cout<<"POSSIBLE";
            return 0;
         }
      }
      if(b[i]==1){
         auto it = s.find(a[i]);
         if(it != s.end()){
            cout<<"POSSIBLE";
            return 0;
         }
      }
   }
   cout<<"IMPOSSIBLE";
   return 0; 
}


Measured memory_bytes: 6528
import java.util.*;

public class Main {
    static int[] colors;
    static ArrayList<Path>[] graph;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		graph = new ArrayList[n + 1];
		for (int i = 1; i <= n; i++) {
		    graph[i] = new ArrayList<Path>();
		}
		for (int i = 0; i < n - 1; i++) {
		    int a = sc.nextInt();
		    int b = sc.nextInt();
		    int length = sc.nextInt();
		    graph[a].add(new Path(b, length));
		    graph[b].add(new Path(a, length));
		}
		colors = new int[n + 1];
		Arrays.fill(colors, -1);
		search(1, 0);
		StringBuilder sb = new StringBuilder();
		for (int i = 1; i <= n; i++) {
		    sb.append(colors[i]).append("\n");
		}
		System.out.print(sb);
	}
	
	static void search(int idx, int color) {
	    if (colors[idx] != -1) {
	        return;
	    }
	    colors[idx] = color;
	    for (Path x : graph[idx]) {
	        int next;
	        if (x.length % 2 == 0) {
	            next = color;
	        } else {
	            next = (1 + color) % 2;
	        }
	        search(x.to, next);
	    }
	}
	
	static class Path {
	    int to;
	    int length;
	    
	    public Path (int to, int length) {
	        this.to = to;
	        this.length = length;
	    }
	}
}


Measured memory_bytes: 107868
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int ans=0,in;
	rep(i,4)cin>>in,ans+=in;
	cout<<ans/60<<endl;
	cout<<ans%60<<endl;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<double,int> Pdi;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
//priority_queue<Pdi,vector<Pdi>,greater<Pdi>> que;
//vector<Pli> v[18];
P2 xy[MAX_N]={};
ll dp[1<<18]={};
string str[100000];
typedef pair<int,int> O;
typedef pair<O,O> P;
vector<int> v[200001];
queue<int> que[2];
bool d[200001]={};
int A[2][100001]={};
int main() {
	int n,v;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>v;
		if(i%2==0)A[0][v]++;
		else A[1][v]++;
	}
	int b[2][2]={},c[2][2]={};
	for(int i=0;i<2;++i){
		for(int j=0;j<100001;j++){
			if(A[i][j]>b[i][0]){
				b[i][1]=b[i][0];
				b[i][0]=A[i][j];
				c[i][1]=c[i][0];
				c[i][0]=j;
			}else{
				if(A[i][j]>b[i][1]){
					b[i][1]=A[i][j];
					c[i][1]=j;
				}
			}
		}
	}
	int ans=b[0][0]+b[1][0];
	if(c[1][0]==c[0][0]){
		ans=max(b[0][0]+b[1][1],b[0][1]+b[1][0]);
	}
	cout<<n-ans<<endl;
	return 0;
}


Measured memory_bytes: 8320
#include <stdio.h>
#define M 45

void build(void);
int x[M];

int main(void){
  int search;
  scanf("%d",&search);
  build();
  printf("%d\n",x[search]);
  return 0;
}

void build(void){
  x[0]=1;
  x[1]=1;
  for(int i=2;i<45;i++){
    x[i]=x[i-1]+x[i-2];
  }
}




Measured memory_bytes: 2112
import sys
S = input()
N = len(S)
M = int((N-1)/2)
L = int((N+3)/2)
for i in range(M):
    if(S[i] != S[-i-1]):
        print('No')
        sys.exit()
for j in range(1,M,1):
    if(S[j] != S[M-1-j]):
        print('No')
        sys.exit()
for k in range(L,N,1):
    if(S[k-1] != S[-1-(k-L)]):
        print('No')
        sys.exit()
print('Yes')


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

using namespace std;

int Minus(int _a)
{
    return 2 - _a;
}

int Plus(int _a, int _b)
{
    return max(_a, _b);
}

int Product(int _a, int _b)
{
    return min(_a, _b);
}

int calc(int _p, int _q, int _r, string _in)
{
//    cout << _in << endl;
    if(_in.size() == 1)
    {
        return _in == "P" ? _p : 
               _in == "Q" ? _q :
               _in == "R" ? _r :
               stoi(_in);
    }


    if(_in[0] == '-'){
        //cout << " - " << _in.substr(1) << endl;
        return Minus(calc(_p, _q, _r, _in.substr(1)));
    }

    int num = 1;
    int count = 1;
    string mae = "";
    while(num < _in.size())
    {
        if(count == 1)
        {            
            if(_in[num] == '*'){
                //cout << mae << " * " << _in.substr(num + 1, _in.size() - mae.size() - 2) << endl;
                return Product( calc(_p, _q, _r, mae), calc(_p, _q, _r, _in.substr(num + 1, _in.size() - num - 2) ) );
            }
            if(_in[num] == '+'){
                //cout << mae << " + " << _in.substr(num + 1, _in.size() - mae.size() - 2) << endl;
                 return Plus( calc(_p, _q, _r, mae), calc(_p, _q, _r, _in.substr(num + 1, _in.size() - num - 2)) );
            }
        }
    
        if(_in[num] == '(')count++;
        if(_in[num] == ')')count--;
        
        mae += _in[num];
        num++;
    }
    
}

int main()
{
    string input;

    while(cin >> input, input != ".")
    {
        int ans = 0;
        for(int p = 0; p <= 2; p++)
        {
            for(int q = 0; q <= 2; q++)
            {
                for(int r = 0; r <= 2; r++)
                {
                    ans += ( calc(p, q, r, input) == 2 );
                }
            }
        }
        cout << ans << endl;
    }
    /*
    cout << calc(0, 1, 0, "((---P+Q)*(--Q+---R))*(-R+-P))") << endl;
    cout << calc(0, 1, 0, "(---P+Q)") << endl;
    cout << calc(0, 1, 0, "(--Q+---R)") << endl;
    cout << calc(0, 1, 0, "(-R+-P)") << endl;
    cout << calc(0, 1, 0, "--Q)") << endl;
    cout << calc(0, 1, 0, "---R)") << endl;
    */
    return 0;
}

Measured memory_bytes: 3160
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    ans = len(set(LI()))
    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9808
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,k = inm()
s = input()
chg = 0
for i in range(n-1):
    if s[i] != s[i+1]:
        chg += 1
if chg <= 2*k:
    print(n-1)
else:
    chg -= 2*k
    print(n-1-chg)


Measured memory_bytes: 3316
#include <iostream>

using namespace std;
#define RAJVI ios_base::sync_with_stdio(false);
#define DAIICT cin.tie(NULL);cout.tie(NULL);

int main()
{
    RAJVI
    DAIICT;
    
    int a=0,b=0,k=-1;
    cin>>a>>b;
    if((a+b)%2==0)
    {
     k=(a+b)/2;
     cout<<k;
        
    }
    else 
    {
        cout<<"IMPOSSIBLE";
        
    }
    
}


Measured memory_bytes: 256