akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>          // printf(), scanf()
#define MAX_N 500000
 
typedef struct node_tbl
{
    int key;
    int parent;
    int left;
    int right;
} node;
 
const int nil = -1;
node t[MAX_N + 1];
int root;
int ix;
 
int
find(int u, int k)
{
    while (u != nil && k != t[u].key)
    {
        if (k < t[u].key)
            u = t[u].left;
        else
            u = t[u].right;
    }
 
    return u;
}
 
void
insert(int k)
{
    int y = nil;
    int x = root;
    int z = ix++;
 
    t[z].key = k;
    t[z].left = nil;
    t[z].right = nil;
 
    while (x != nil)
    {
        y = x;
        if (t[z].key < t[x].key)
            x = t[x].left;
        else
            x = t[x].right;
    }
 
    t[z].parent = y;
    if (y == nil)
        root = z;
    else
    {
        if (t[z].key < t[y].key)
            t[y].left = z;
        else
            t[y].right = z;
    }
}
 
void
inorder(int u)
{
    if (u == nil)
        return;
 
    inorder(t[u].left);
    printf(" %d", t[u].key);
    inorder(t[u].right);
}
 
void
preorder(int u)
{
    if (u == nil)
        return;
 
    printf(" %d", t[u].key);
    preorder(t[u].left);
    preorder(t[u].right);
}
 
int
main(int argc, char** argv)
{
    char command[8];
    int n;
    int x;
    int i;
 
    root = nil;
    ix = 0;
    scanf("%d", &n);
    for (i = 0; i < n; ++i)
    {
        scanf("%s", command);
        switch (command[0])
        {
        case 'f':
            scanf("%d", &x);
            printf("%s\n", find(root, x) != nil ? "yes" : "no");
            break;
 
        case 'i':
            scanf("%d", &x);
            insert(x);
            break;
 
        case 'p':
        default:
            inorder(root);
            printf("\n");
 
            preorder(root);
            printf("\n");
            break;
        }
    }
 
    return 0;
}


Measured memory_bytes: 8032
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int D;
    cin >> D;
    if(D==25) cout << "Christmas";
    else if(D==24) cout << "Christmas Eve";
    else if(D==23) cout << "Christmas Eve Eve";
    else cout << "Christmas Eve Eve Eve";
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N,T,i,j;
  long ans=0;
  scanf("%d %d",&N,&T);
  int A[N];
  for(i=0;i<N;i++)
    scanf("%d ",&A[i]);
  
  for(i=0;i<N-1;i++){
    if(A[i+1] - A[i] < T)
      ans += (A[i+1]-A[i]);
    else
      ans += T;
  }
  ans += T;
  printf("%ld\n",ans);
  return 0;
}



Measured memory_bytes: 896
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define MOD 100000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
struct A{int x,y,c;};
int dx[6]={-1,-1,0,0,1,1};
int dy[6]={-1,0,1,-1,1,0};
int main(){
      int t,n,x,y,sx,sy;
      while(cin>>t>>n&&(t!=0||n!=0)){
            bool used[121][121];
            memset(used,true,sizeof(used));
            REP(i,n){cin>>x>>y;used[x+60][y+60]=false;}
            cin>>sx>>sy;
            int cnt=1;used[sx+60][sy+60]=false;
            queue<A> Q;
            Q.push((A){sx+60,sy+60,0});
            while(!Q.empty()){
                  //cout<<Q.size()<<endl;
                  A a=Q.front();Q.pop();
                  if(a.c>=t)continue;
                  REP(i,6){
                        int nx=a.x+dx[i],ny=a.y+dy[i];
                        //cout<<nx<<" "<<ny<<endl;
                        if(used[nx][ny]){
                              //cout<<nx<<" "<<ny<<endl;
                              used[nx][ny]=false;
                              Q.push((A){nx,ny,a.c+1});
                              cnt++;
                        }
                  }
            }
            cout<<cnt<<endl;
      }
}

Measured memory_bytes: 1236
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    string S;
    cin >> S;
    char c = S[0];
    int ans = 0;
    for (int i = 1; i < S.length(); i++) {
        if (c != S[i]) {
            ans++;
            c = S[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
ll mod=1e9+7;
#define PI acos(-1)
struct edge{int from, to;};

int main(){
    int h, a;
    cin>>h>>a;
    int cnt=0;
    while(h>0){
        h-=a;
        cnt++;
    }
    cout<<cnt<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if ((x >= r && x <= W - r) && (y >= r && y <= H - r))
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 3068
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	k, _ := strconv.Atoi(sc.Text())
	
	a := make([]int, n, n)
	m := 0
	for i := 0; i < n; i++ {
		sc.Scan()
		tmp, _ := strconv.Atoi(sc.Text())
		a[i] = tmp

		if i < k {
			m += tmp
		}
	}

	tmp := m
	for i := k; i < n; i++ {
		tmp += (a[i] - a[i - k])
		if tmp > m {
			m = tmp
		}
	}

	fmt.Println(float64(m + k) / 2)
}


Measured memory_bytes: 3072
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> P;

void Input(VVI& G,int n)
{
  for(int i=0;i<n;i++)
    {
      G[i].resize(n);
      for(int j=0;j<n;j++)
	{
	cin >> G[i][j];

	}
     
    }
}

VVI rotate90(VVI G)
{
  int n = G.size();

  VVI ret;
  ret.resize(n);

  for(int i=0;i<n;i++)
    {
      ret[i].resize(n);
      for(int j=0;j<n;j++)
	ret[i][j] = G[j][n-i-1];
    }

  return ret;
}

bool check(VVI& G,VVI& G2, P p)
{

  for(int i=p.S;i<p.S+G2.size();i++)
    {
      for(int j=p.F;j<p.F+G2.size();j++)
	{	
	  if(G2[i-p.S][j-p.F] == -1)
	    continue;
	  else if(!(i < G.size() && j < G.size()) )
	    return false;
	  else if(G[i][j] != G2[i-p.S][j-p.F])
	    return false;
	}
 
    }
  return true;
}

int main()
{
  int n,m;
  while(cin >> n >> m,n|m)
    {
     
      VVI G,G2;
      bool Fin = false;
      G.resize(n);
      G2.resize(m);
      Input(G,n);    
      Input(G2,m);
      vector<P> vec;
    
      for(int x = 0; x < 4; x++){
	
	for(int i=0;i<G.size();i++)
	  {
	    for(int j=0;j<G.size();j++)
	      {
		if(check(G,G2,P(j,i)))
		{
		  Fin = true;
		  bool f = false;
		  for(int k=0;k<G2.size();k++)
		    {
		    for(int l=0;l<G2.size();l++)
		      {
			if(G2[k][l] != -1)
			  {
			    vec.push_back(P(i+k+1,j+l+1));
			    f = true;
			    break;
			  }
		      }
		    if(f)
		      break;
		    }
		
		}
	      }
	  }

	G2 = rotate90(G2); 
      }
      
      sort(vec.begin(),vec.end());

      if(!vec.size())
	cout << "NA" << endl;
      else 
	cout << vec[0].S << " " << vec[0].F << endl;

    }
  return 0;
}

Measured memory_bytes: 1392
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10010;

int main()
{
  int64_t N, K, d;
  cin >> N >> K;
  vector<bool> ok(10, true);
  for (int i = 0; i < K; i++)
  {
    cin >> d;
    ok.at(d) = false;
  }
  for (int64_t i = N; i < MAXN * 100; i++)
  {
    int64_t n = i;
    bool flg = true;
    while (n > 0)
    {
      if (!ok.at(n % 10))
      {
        flg = false;
      }
      n /= 10;
    }
    if (flg)
    {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <string>
#include <map>
using namespace std;
map<string,int> s;
int main() {
	s["SAT"] = 1;
	s["FRI"] = 2;
	s["THU"] = 3;
	s["WED"] = 4;
	s["TUE"] = 5;
	s["MON"] = 6;
	s["SUN"] = 7;
	string str;
	cin >> str;
	printf("%d",s[str]);
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    int n;
    long w;
    long[] vs;
    long[] ws;
    ArrayList<ArrayList<Long>> is;

    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    private void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        w = sc.nextLong();
        vs = new long[n];
        ws = new long[n];
        is = new ArrayList<>(4);
        for (int i = 0; i < 4; i++) is.add(new ArrayList<>());
        for (int i = 0; i < n; i++) {
            ws[i] = sc.nextLong();
            vs[i] = sc.nextLong();
            int j = (int) (ws[i] - ws[0]);
            is.get(j).add(vs[i]);
        }

        for (int i = 0; i < 4; i++)
            is.get(i).sort(Comparator.reverseOrder());
    }

    private void solve() {
        long ans = 0;
        long weight, tmp;
        for (int i = 0; i <= is.get(0).size(); i++) {
            for (int j = 0; j  <= is.get(1).size(); j++) {
                for (int k = 0; k <= is.get(2).size(); k++) {
                    for (int l = 0; l <= is.get(3).size(); l++) {
                        weight = ws[0] * i + (ws[0] + 1) * j +
                                (ws[0] + 2) * k + (ws[0] + 3) * l;
                        if (weight > w)
                            continue;
                        tmp = 0;
                        for (int m = 0; m < i; m++) {
                            tmp += is.get(0).get(m);
                        }
                        for (int m = 0; m < j; m++) {
                            tmp += is.get(1).get(m);
                        }
                        for (int m = 0; m < k; m++) {
                            tmp += is.get(2).get(m);
                        }
                        for (int m = 0; m < l; m++) {
                            tmp += is.get(3).get(m);
                        }
                        ans = Long.max(ans, tmp);
                    }
                }
            }
        }
        System.out.println(ans);
    }

}


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

int main()
{

    int n,t;
    cin>>n>>t;
    pair<int,int>a[n];
    int minvalue=INT_MAX;
    int cost=INT_MAX;
    for(int i=0;i<n;i++)
    {
        cin>>a[i].first>>a[i].second;
        if(a[i].first<cost && a[i].second<=t)
        {
            cost=a[i].first;

        }
    }
    if(cost==INT_MAX)
    {
        cout<<"TLE\n";
    }
    else
    cout<<cost<<"\n";






return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main(){
    int n;
    cin>>n;
    vector<int> a(3*n);
    
    priority_queue<int,vector<int>,greater<int>> quel;
    priority_queue<int> quer;
    
    ll left=0,right=0;
    
    rep(i,0,3*n){
        cin>>a.at(i);
        if(i<n) {
            left+=a.at(i);
            quel.push(a.at(i));
        }
        else if(i>=2*n) {
            right+=a.at(i);
            quer.push(a.at(i));
        }
    }
    
    vector<ll> l(n+1);
    rep(i,n,2*n){
        l.at(i-n)=left;
        left+=a.at(i);
        quel.push(a.at(i));
        left-=quel.top();
        quel.pop();
    }
    l.at(n)=left;
    
    vector<ll> r(n+1);
    rrep(i,2*n,n){
        r.at(i+1-n)=right;
        right+=a.at(i);
        quer.push(a.at(i));
        right-=quer.top();
        quer.pop();
    }
    r.at(0)=right;
    
    ll ans=-1000000000000000;
    rep(i,0,n+1) ans=max(ans,l.at(i)-r.at(i));
    cout<<ans<<endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define int long long

using namespace std;


signed main(){
  int A, B, C;
  int res;
  cin>>A>>B>>C;
  if ((A<=C && B>=C) || (A>=C && B<=C)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    N = readint()
    ab = [tuple(readnums()) for _ in range(N)]
    ans = 0
    for a, b in reversed(ab):
        ans += b - ((a + ans) % b) if (a + ans) % b else 0

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 16616
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// エラストテネスの篩
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true); 
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// 回文の判定
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

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

    ll ans = 0;
    ll now = 360;
    while(true){
        if(now - x == 0){
            ans++;
            break;
        }else if(now - x > 0){
            now -= x;
        }else{
            ll a = x - now;
            now = 360 - a;
        }
        ans++;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}



int main(){FIN
    ll n,k; cin>>n>>k;
    ll ans=0;
    if (k==0) {
        cout <<n*n<<endl;
        return 0;
    }
    for(ll i=k+1; i<=n;i++){
        ans += (n/i) * (i-k);
        if ( n%i-k+1>0) ans += (n%i)-k+1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC089A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n,a;
            n = int.Parse(Console.ReadLine());
            a = n / 3;
            Console.WriteLine(a);
            Console.ReadKey();
        }
    }
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;

int main(){
    int a,b,c,n;
    cin>>a>>b>>c>>n;
    int ans=0;
    rep(i,(n/a)+1)rep(j,(n/b)+1){
        if(n-i*a-j*b>=0 && (n-i*a-j*b)%c==0){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
//KING NIKAN
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
ll ans[60] ;
int main() 
{
	ios::sync_with_stdio(false) ;cin.tie(0) ;cout.tie(0) ;
	ll k ;
	cin >> k ;
	cout << 50 << "\n" ;
	ll x=k/50 ;
	for(int i=0 ;i<50 ;i++)
	{
        ans[i] = x+49;
    }
    ll y = k%50;
    for(int k=0 ;k<y ;k++)
	{
        for(int i=0 ;i<50 ;i++)
		{
            if(k==i) 
			{
				ans[i]+=50 ;	
			}
            else 
			{
				ans[i]-=1 ;	
			}
        }
    }
    for(int i=0 ;i<50 ;i++)
    {
    	cout << ans[i] << " " ;
	}
	return 0 ;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if(n == 1) {
            System.out.println("Hello World");
        } else if(n == 2) {
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println(a+b);
        }
    }
}

Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	
	private static boolean check(long[] a, double val, double k) {
		for (int i = 0; i < a.length; i++) {
			k -= Math.ceil(a[i] / val) - 1;
		}
		return k >= 0;
	}
	
    public static void main(String[] args) throws IOException {
    	Scanner s = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] input;
		input = reader.readLine().split(" ");
		int n = Integer.parseInt(input[0]), k = Integer.parseInt(input[1]);
		input = reader.readLine().split(" ");
		long[] a = new long[n];
		double start = 0.00000000001, end = 0;
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(input[i]);
			end = Math.max(end, a[i]);
		}
		double ans = end;
		while (Math.ceil(start) != Math.ceil(end) && start <= end) {
			double mid = (start + end) / 2;
			if (check(a, mid, k)) {
				ans = mid;
				end = mid - 0.00000001;
			} else {
				start = mid + 0.00000001;
			}
		}
		out.print((long)Math.ceil(ans));
		out.flush();
		out.close();
    }

}


Measured memory_bytes: 64200
n=int(input())
A=list(map(int,input().split()))
B=[0]*(n+3)
for i in range(n):
  B[A[i]]+=1
ans=0
for i in range(n+3):
  ans=ans+B[i]*(B[i]-1)//2
for i in range(n):
  print(ans-B[A[i]]+1)

Measured memory_bytes: 26140
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;

int main(){
  int a,b,k,x;
  cin >> a >> b >> k;
  for(int i=100;i>0;i--){
    if(a % i == 0 && b % i == 0){
      x = i;
      k--;
      if(k == 0){
        break;
      }
    }
  }
  cout << x;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 100005;

int main() {
    int n;
    cin >> n;
    map<string, int> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for (auto t : mp) {
        mx = max(mx, t.second);
    }
    for (auto t : mp) {
        if (t.second == mx) cout << t.first << endl;
    }
    return 0;
}


Measured memory_bytes: 25216
#include <iostream>
#include <fstream>
#include <sstream>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

#define pb push_back
#define pbk pop_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define len(a) ((int) (a).size())

#ifdef CUTEBMAING
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

using namespace std;

typedef long long int64;
typedef long double ld;
typedef unsigned long long lint;

const int inf = (1 << 30) - 1;
const int64 linf = (1ll << 62) - 1;

int main() {
#ifdef XCODE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n; cin >> n;
    vector<int> a = { 0 };
    for (int i = 0; i < n; i++) {
    	int x; scanf("%d", &x);
    	a.pb(x);
    }
    a.pb(0);
    int64 sum = 0;
    for (int i = 0; i < len(a) - 1; i++) {
    	sum += abs(a[i] - a[i + 1]);
    }
    for (int i = 1; i <= n; i++) {
    	int64 newSum = sum;
    	newSum -= abs(a[i - 1] - a[i]);
    	newSum -= abs(a[i] - a[i + 1]);
    	newSum += abs(a[i - 1] - a[i + 1]);
    	cout << newSum << " \n"[i == n];
    }
    return 0;
}


Measured memory_bytes: 1784
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
  int a, b;
  cin >> a >> b;
  
  cout << max({ a+b, a-b, a * b }) << endl;
}

Measured memory_bytes: 256
#!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.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.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():
    def s(n):
        if n&3 == 3:
            return 0
        m = 4*(n//4)
        res = 0
        for i in range(m,n+1):
            res ^= i
        return res
    a,b = LI()
    if a == 0:
        print(s(b))
    else:
        print(s(b)^s(a-1))
    return

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


Measured memory_bytes: 38384
import java.util.*;
import java.util.stream.Stream;

public class Main {

    private static int N;
    private static int A[][];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        A = new int[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                A[i][j] = sc.nextInt();
            }
        }
        System.out.println(solve());
    }

    static long solve() {

        boolean[][] indirect = new boolean[N][N];

        for (int i = 0; i < N-1 ; i++) {
            for (int j = i+1; j < N ; j++) {
                for (int k = 0; k < N; k++) {
                    if( k == i || k == j ) continue;
                    int ikj = A[i][k] + A[k][j];
                    int ij = A[i][j];
                    if( ikj < ij ) {
                        return -1;
                    } else if( ikj == ij ) {
                        indirect[i][j] = true;
                    }
                }
            }
        }

        long ans = 0;
        for (int i = 0; i < N-1 ; i++) {
            for (int j = i+1; j < N ; j++) {
                if( !indirect[i][j] ) {
                    ans += A[i][j];
                }
            }
        }

        return ans;
    }
}


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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define print(x) cout << x << endl

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

ll MOD = 1000000007;


int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    ll tmp = a + b - c;
    ll tmp2 = 4 * a * b;
    bool flag = false;
    if (tmp < 0 && tmp * tmp > tmp2)
        flag = true;
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define x first
#define y second
#define oo 1000000000
#define PLL pair <ll, ll>
#define INF 1000000000000007
 
using namespace std;

ll n, x, rs;
set < PLL > S;
vector < ll > D(100100, INF);
vector < PLL > V[100100];

void di(int x)
{
    S.insert(mp(0, x));
    D[x] = 0;
    while (S.size())
    {
        ll curr = S.begin()->second;
        S.erase(S.begin());
        for (auto it : V[curr])
        {
            ll vertex = it.first;
            ll weight = it.second;
            if (D[vertex] > D[curr] + weight)
            {
                if (D[vertex] != INF)
                    S.erase(S.find(mp(D[vertex], vertex)));
                D[vertex] = D[curr] + weight;
                S.insert(mp(D[vertex], vertex));
            }
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (ll i = 1, x, y, z; i < n; i++){
        cin >> x >> y >> z;
        V[x].push_back({y, z});
        V[y].push_back({x, z});
    }
    ll m, k;
    cin >> m >> k;
    di(k);
    for (int i = 1; i <= n; i++)
        D[i] = (D[i] == INF ? 0 : D[i]);
        
    for (int i = 1, x, y; i <= m; i++){
        cin >> x >> y;
        cout << D[x] + D[y] << "\n";
    }
}


Measured memory_bytes: 15344
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		List<Dice> DiceList = new ArrayList<Dice>();
		String hantei,match="Yes";

		int count = sc.nextInt();

		for(int i=0; i<count; i++) {
			DiceList.add(new Dice(sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()));
		}

		for(int i=0; i<DiceList.size(); i++) {
			for(int x=0; x<DiceList.size(); x++) {
				if(x!=i) {
				hantei=hantei(DiceList.get(i),DiceList.get(x));
				if(hantei.equals("Yes")){
					match ="No";
				}
				}
			}
		}
		System.out.println(match);
	}
	static String hantei(Dice dice1,Dice dice2 ) {
		String shijirow = "EEENEEENEEESEEESEEENEEEN";
		for(int i =0; i<shijirow.length(); i++) {
			if(dice2.equals(dice1)) {
				return "Yes";
			}
			dice1.roll(shijirow.charAt(i));
		}
		return "No";
	}
}

class Dice {
	int up =1;
	int front = 2;
	int left = 3;
	int right = 4;
	int back = 5;
	int down = 6;

	Dice(){};

	Dice(int up,int front,int left,int right, int back, int down){
		this.up = up;
		this.front = front;
		this.left =left;
		this.right = right;
		this.back = back;
		this.down = down;

	}


	void roll(char Shiji) {
		int  tmp;
		switch(Shiji) {
		case 'N':{
			tmp = up;
			this.up = this.front;
			this.front = this.down;
			this.down = this.back;
			this.back = tmp;
			break;
		}
		case 'E':{
			tmp = this.up;
			this.up = this.right;
			this.right = this.down;
			this.down = this.left;
			this.left = tmp;
			break;
		}
		case 'W':{
			tmp = this.up;
			this.up = this.left;
			this.left = this.down;
			this.down = this.right;
			this.right = tmp;
			break;
		}
		case 'S':{
			tmp = this.up;
			this.up = this.back;
			this.back = this.down;
			this.down = this.front;
			this.front = tmp;
			break;
		}
		}

	}
	public boolean equals(Object obj) {
		Dice other = (Dice) obj;

		if (up != other.up) {
			return false;
		}


		if (front != other.front) {
			return false;
		}


		if (left != other.left) {
			return false;
		}

	
		if (right != other.right) {
			return false;
		}


		if (back != other.back) {
			return false;
		}


		if (down != other.down) {
			return false;
		}
		return true;
	}
}



Measured memory_bytes: 29652
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
void go();
int main() {
#ifdef tokitsukaze
    freopen("TEST.txt", "r", stdin);
#endif
    go();
    return 0;
}

/*********************************  head  *********************************/


int n,a[100100];
int cmp(int a,int b){
    return a>b;
}
LL ans;
void go() {
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    sort(a,a+n,cmp);
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;++j){
            int t=lower_bound(a+j,a+n,a[i]-a[j],greater<int>())-a;
            t-=1;
            if(t>j)
            ans+=t-j;
        }
    }
    cout<<ans<<endl;
}


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

int main(){
    int N;
    cin >> N;
    int w[N];
    int min = 1000000;
    int s1,s2;

    for(int i = 0; i < N; i++)
    {
        cin >> w[i];
    }
    
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j <= i; j++)
        {
            s1 += w[j]; 
        }
        for(int k = i+1; k < N; k++)
        {
            s2 += w[k];
        }
        if( abs(s1-s2) < min ){
            min = abs(s1-s2);
        }
        s1 =0;
        s2=0;
    }
    cout << min <<endl;
    
}   


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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}

// 空のベクトルを二つ渡す。N (>=2) 以下の素数を primes に順番に入れる。
void prime_vectors(int N, vector<int>& primes, vector<bool>& is_prime){
    primes = {};
    is_prime = {};
    for(int i=0; i<=N; i++){
        is_prime.push_back(true);
    }

    primes.push_back(2);
    for(int j=4; j<=N; j+=2){
        is_prime[j] = false;
    }

    int i;
    for(i=3; i*i<=N; i+=2){
        if(!is_prime[i]) continue;
        primes.push_back(i);
        for(int j=2*i; j<=N; j+=i){
            is_prime[j] = false;
        }
    }

    for(; i<=N; i+=2){
        if(is_prime[i]){
            primes.push_back(i);
        }
    }
}

int fact(int n){
    int ans = 1;
    for(int i=1; i<=n; i++){
        ans *= i;
    }
    return ans;
}

signed main(){
    cout << fixed << setprecision(10) << flush;

    int n;
    cin >> n;
    vector<int> x(n), y(n);
    for(int i=0; i<n; i++){
        cin >> x[i] >> y[i];
    }

    double dis = 0.0;

    #if 0
    vector<int> b(n);
    for(int i=0; i<n; i++){
        b[i] = i;
    }

    do{
        for(int i=0; i<n; i++){
            dis += sqrt((x[i] - x[b[i]]) * (x[i] - x[b[i]]) + (y[i] - y[b[i]]) * (y[i] - y[b[i]]));
        }
    }while(next_permutation(b.begin(), b.end())); 
    
    cout << dis / fact(n) << endl;
    #else
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            dis += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
        }
    }
    cout << dis/n << endl;
    #endif
    
    return 0;
}

Measured memory_bytes: 3720
/*
   Creator - Glitched
   Yeet!!
*/

#include "bits/stdc++.h"
#include "stdlib.h"
using namespace std;
#define testcases ll t;cin>>t;while(t--)
#define queries ll q;cin>>q;while(q--)
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++)

#define ff first
#define ss second
#define pb push_back
#define elif else if
#define flush cout<<"\n"
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{   
    bool ans=true;
    ll n;
    cin>>n;
    vector<ll> v(n);
    loop(i,0,n)cin>>v[i];

    sort(v.begin(), v.end());

    loop(i,1,n){
        if(v[i]==v[i-1]){
            ans = false;
            break;
        }
    }
    cout<<(ans?"YES":"NO");


    
}

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

int main(){

    int n, m;
    cin >> n >> m;

    int l[m], r[m];
    for(int i=0; i<m; i++){
        
        cin >> l[i] >> r[i];
    }

    int lmax = *max_element(l, l+m);
    int rmin = *min_element(r, r+m);

    if( rmin < lmax ){
        cout << 0 << endl;
    }else{
        cout << rmin - lmax + 1;
    }

    return 0;
}

Measured memory_bytes: 1024
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}

int dp[100001][2];
vector<int> v[100001];
void dfs(int u,int p)
{
    for(int i=0;i<v[u].size();++i)
    {
        if(v[u][i]==p)
            continue;
        else
        {
            dfs(v[u][i],u);
        }
    }

    if((v[u].size()==1 and v[u][0]==p)or v[u].size()==0)
    {
        dp[u][0]=1;
        dp[u][1]=1;
        return;
    }
    int ans=1,ans1=1;
    for(int i=0;i<v[u].size();++i)
    {
        if(v[u][i]==p)
            continue;
        else
        {
            ans=(ans%mod*(dp[v[u][i]][0])%mod)%mod;
            ans1=(ans1*(dp[v[u][i]][0]+dp[v[u][i]][1]))%mod;
        }
    }
   // cout<<ans<<" "<<ans1<<" "<<u<<endl;
    dp[u][1]=ans%mod;
    dp[u][0]=ans1%mod;

}

int32_t main()
{
    IOS
    
    
        int n;
        cin>>n;
        for(int i=0;i<n-1;++i)
        {
            int p,q;
            cin>>p>>q;
            v[p].push_back(q);
            v[q].push_back(p);

        }
        memset(dp,0,sizeof(dp));
        dfs(1,0);
        cout<<(dp[1][0]+dp[1][1])%mod;


}



Measured memory_bytes: 12800
# 1-index
from sys import stdin
H, N = [int(x) for x in stdin.readline().rstrip().split()]

data = [0]*N

for i in range(N):
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    data[i] = (A, B)
dp = [10**9]*(H+1)
dp[0] = 0

for h in range(0,H+1):
    for a,b in data:
        if h+a >= H:
            dp[H] = min(dp[h]+b,dp[H])
        else:
            dp[h+a] = min(dp[h]+b,dp[h+a])
print(dp[H])

Measured memory_bytes: 41564
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw_2(62,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,61) pw_2[i]=-2*pw_2[i-1];}
    
    ll N; cin>>N;
    
    if(N==0){
        cout<<0<<endl;
        return 0;
    }
    vector<ll> ans;
    ll rem=N;
    ll i=0;
    while(rem!=0){
        if(rem%pw2[i+1]!=0){
            ans.pb(1);
            rem-=pw_2[i];
        }
        else ans.pb(0);
        
        i++;
    }
    rrep(i,sz(ans)) cout<<ans[i];
}



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

typedef long long ll;
typedef unsigned long long ull;

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

int main(){
    ll dp[102][9];
    for(int i=0;i<8;i++) dp[0][i]=0;
    dp[0][0]=1;
    int H, W, K;
    ll pat[9];
    pat[0]=pat[1]=1;
    for(int i=2;i<9;i++) pat[i]=pat[i-1]+pat[i-2];
    cin >> H >> W >> K;

    for(int h=1;h<=H;h++){
        for(int w=0;w<W;w++){
            dp[h][w]=0;
            if(w-1>=0){
                dp[h][w] += dp[h-1][w-1]*pat[w-1]%MOD*pat[W-w-1]%MOD;
                dp[h][w] %= MOD;
            }
                dp[h][w] += dp[h-1][w]  *pat[w]  %MOD*pat[W-w-1]%MOD;
                dp[h][w] %= MOD;
            if(w+1<=W-1){
                dp[h][w] += dp[h-1][w+1]*pat[w]  %MOD*pat[W-w-2]%MOD;
                dp[h][w] %= MOD;
            }
        }
    }

    cout << dp[H][K-1]%MOD << endl;

    return 0;
}

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

using namespace std;

int main() {
  int H, W, K; cin >> H >> W >> K;
  int C[H][W];
  for (int i = 0; i < H; i++) {
    string x; cin >> x;
    for (int j = 0; j < W; j++) {
      int y = x.at(j) == '#' ? 1 : 0;
      C[i][j] = y;
    }
  }

  int ans = 0;

  // For some reason, I falsely believed that O(2^(H+W)) where H + W <= 12 was not computable in the given time
  // Under pressure, I quickly assumed this, confusing 2^12 with 1e12
  // If I had done one check to see that 2^12 = 4096, which is easily computable with brute force bitwise search, then it would have made the difference between heaven and hell

  // O(HW * 2^(H + W))
  int full = (1 << (H + W)) - 1;
  for (int i = 0; i < full; i++) {
    // The bits of the last W digits represent the status of the columns while the next H digits represent the status of the rows 
    int value = 0;
    for (int r = 0; r < H; r++) {
      for (int c = 0; c < W; c++) {
        if ((i & (1 << c)) | (i & (1 << (r + W)))) {
          // Either the row or column that the element belongs to is activated - do not count
          continue;
        }
        value += C[r][c];
      }
    }

    if (value == K) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3616
N, K = map(int, input().split())
H = []

m_dfr = 9999999999999999

for i in range(N):
	H.append(int(input()))

H = sorted(H, reverse = True)
# print(H)

for i in range(0, N - K + 1):
	# print(H[i], H[i + K - 1])
	if m_dfr > H[i] - H[i + K - 1]:
		m_dfr = H[i] - H[i + K - 1]

print(m_dfr)

Measured memory_bytes: 51544
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <map>
#include <cctype>
#include <string>
#include <cstdlib>
#include <math.h>
using namespace std;

int main()
{
  cout << setprecision(6);
  cout << setiosflags(ios::scientific);
  cout.flags(ios::fixed);

  double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  double res = pow(x1-x2, 2) + pow(y1-y2,2);
  cout << sqrt(res) << endl;

}

Measured memory_bytes: 1280
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inputs;
		inputs = br.readLine().split(" ");
		int n = Integer.parseInt(inputs[0]), m = Integer.parseInt(inputs[1]);

		// ノード配列作成
		Node[] nodes = new Node[n];
		for ( int i = 0; i < n; i++ ) {
			nodes[i] = new Node();
		}
		for ( int i = 0; i < m; i++ ) {
			inputs = br.readLine().split(" ");
			int x = Integer.parseInt(inputs[0]) - 1, y = Integer.parseInt(inputs[1]) - 1;
			nodes[x].chldList.add(nodes[y]);
			nodes[y].prntCnt++;
		}

		// 始点サーチ
		ArrayDeque<Node> toCheck = new ArrayDeque<>();
		for ( Node node : nodes ) {
			if ( node.prntCnt == 0 ) toCheck.add(node);
		}

		// BFSで距離計算開始
		int lenMax = 0;
		while ( toCheck.size() > 0 ) {
			Node node = toCheck.pollFirst();
			for ( Node chld : node.chldList ) {
				chld.prntCnt--;
				chld.len = Math.max(node.len + 1, chld.len);
				lenMax = Math.max(lenMax, chld.len);
				// 全返をチェックした子はチェックリストへ
				if ( chld.prntCnt == 0 ) {
					toCheck.add(chld);
				}
			}
		}
		System.out.println(lenMax);
	}
}

class Node{

	int				len			= 0;
	int				prntCnt		= 0;
	ArrayList<Node>	chldList	= new ArrayList<>();

	public Node() {
	}
}


Measured memory_bytes: 53236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    ll A,B;
    cin >> A >> B;
    cout << A*B/__gcd(A,B) << endl;
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum, ans, dp[10000][2], a[110000];
Pll b[110000];
string str, ss,dd;
bool f,ff;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ -1,0 } ,{ 0,-1 } };
struct Edge { LL to, cost; };
vector<Edge>vec[10000];
vector<LL>v;
map<string, LL>ma;
set<LL>st;
int  par[1100000];  // リーダーの値を格納 

int find(int x) { if (par[x] == x)return x; par[x] = find(par[x]); return par[x]; }
void unite(int x, int y) { x = find(x); y = find(y); if (x == y)return; par[x] = y; }
bool same(int x, int y) { return find(x) == find(y); }
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n >> m;for (int i = 0; i<110000; i++)par[i] = i;
	rep(i, n)cin >> a[i];
	rep(i, m) {
		cin >> b[i].fir >> b[i].second;
		unite(b[i].first, b[i].second);
	}
	rep(i, n) {
		if(same(i + 1, a[i]))ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;
string s;

int main() {
  int n, m;cin >>n>>m;
  vector<vector<int>> v(m);
  for (int i=0;i<m;++i){
    int k; cin>>k;
    vector<int> vt(k);
    for(int j=0;j<k;++j){
      cin >> vt[j];
    }
    v[i] = vt;
  }
  vector<int> vp(m);
  for(int l=0;l<m;++l){
    cin >> vp[l];
  }
  int cnt = 0;
  for (int bit=0;bit < (1<<n); ++bit) {
    int nlight=0;
    for (int i1=0;i1<m;++i1){
      int nswitch = 0;
      for (auto itr=v[i1].begin();itr!=v[i1].end();++itr){
        if (bit & (1<<*itr-1)) ++nswitch;
      }
      if(nswitch%2==vp[i1]) ++nlight;
    }
    if (nlight==m) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;

using ll = long long;
bool isset(int mask , int i)
{
  return (mask & (1 << i));
}

const ll inf = 1e18;

ll groupCost(const vector<vector<ll>>& vec, int mask)
{
  ll ret = 0;
  int n = vec.size();
  for (int i = 0; i < n; ++i)
  {
    if (!isset(mask, i)) continue;
    for (int j = i + 1; j < n; ++j)
    {
      if (isset(mask, j))
        ret += vec[i][j];
    }
  }
  return ret;
}

#define DB2(x, y) cout << #x << ' ' << x << '|' << #y << ' ' << y << '\n'

/*string toBinary(int n)
{
  string s;
  while (n)
  {
    if (n & 1)
     s += '1';
   else
    s += '0';
   n >>= 1;
  }
 reverse(s.begin(), s.end());
 return s;
}
*/

int main()
{
  int n;
  cin >> n;
  vector<vector<ll>> a(n, vector<ll>(n));
  for (int i = 0; i < n; ++i ) {
    for (int j = 0; j < n; ++j) {
      cin >> a[i][j];
    }
  }

  vector<ll> cost(1 << n), dp(1 << n, -inf);
  dp[0] = 0;

  for (int mask = 0; mask < (1 << n) ; ++mask) {
    cost[mask] = groupCost(a, mask);
   // DB2(toBinary(mask), cost[mask]);
  }

  vector<int> not_included;

  for (int mask = 0; mask < (1<<n); ++mask)
  {
    not_included.clear();
    for (int i = 0; i < n; ++i) {
      if (!isset(mask,i))
        not_included.push_back(i);
    }

    int ss = not_included.size();
    for (int mask2 = 0 ; mask2 < (1 << ss); ++mask2) {
      int x = 0;
      for (int i = 0; i < ss; ++i) {
        if (isset(mask2, i))
          x |= (1 << not_included[i]);
      }
      ll points = cost[x];
      dp[mask | x] = max(dp[mask | x], (points + dp[mask]));
    }
  }
  cout << dp[(1 << n) - 1] << '\n';


  return 0;
}


Measured memory_bytes: 1280
import heapq
X, Y, Z, K = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()],reverse=True)
B = sorted([int(i) for i in input().split()],reverse=True)
C = sorted([int(i) for i in input().split()],reverse=True)
def set_tuple(A,B,C,x,y,z):
    return (-(A[x]+B[y]+C[z]),x,y,z)
Q = []
heapq.heappush(Q,set_tuple(A,B,C,0,0,0))
Ans = []
memo = {(0,0,0):True}
for _ in range(K):
    e,x,y,z = heapq.heappop(Q)
    Ans.append(-e)
    if x+1 < X and (x+1,y,z) not in memo:
        heapq.heappush(Q,set_tuple(A,B,C,x+1,y,z))
        memo[(x+1,y,z)] = True
    if y+1 < Y and (x,y+1,z) not in memo:
        heapq.heappush(Q,set_tuple(A,B,C,x,y+1,z))
        memo[(x,y+1,z)] = True
    if z+1 < Z and (x,y,z+1) not in memo:
        heapq.heappush(Q,set_tuple(A,B,C,x,y,z+1))
        memo[(x,y,z+1)] = True
for i in Ans[:K]:print(i)

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

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

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

void Main()
{
	int a, b;
  	cin >> a >> b;
	cout << 2*b-a << endl;
	return;
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int arr[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
  int k;
  cin >> k;
  cout << arr[k - 1];
}


Measured memory_bytes: 256