akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

int c[3][3];

signed main() {
  INIT;

	REP(hi, 3) {
		REP(wi, 3) {
			cin >> c[hi][wi];
		}
	}

	bool ok = true;
	REP(hi, 3) {
		vector< int > tmp(3, 0);
		REP(wi, 3) {
			tmp[wi] = c[hi][wi] - c[0][wi];
		}
		ok &= (tmp[0] == tmp[1] && tmp[1] == tmp[2]);
	}
	OUT(ok ? "Yes" : "No")BR;
	
  return 0;
}


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const double INF = 1e18;
const LL MOD = 1e9+7;

struct C{
  double x, y, r;
  C(double x=0,double y=0, double r=0):x(x),y(y),r(r)
  {}
};

double dist(C& c1, C& c2){
  double dx = c1.x - c2.x;
  double dy = c1.y - c2.y;
  if(dx*dx + dy*dy <= (c1.r+c2.r)*(c1.r+c2.r))
	return 0.;
  return sqrt((dx*dx + dy*dy)) - sqrt((c1.r+c2.r)*(c1.r+c2.r));
}

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

  C s, t;
  cin >> s.x >> s.y >> t.x >> t.y;
  int N; cin >> N;
  vector<C> cs;
  cs.PB(s);
  REP(i,N){
	C c;
	cin >> c.x >> c.y >> c.r;
	cs.EB(c);
  }
  cs.PB(t);

  vector<vector<double>> ds(N+2, vector<double>(N+2));
  REP(i,N+2) REP(j,i+1){
	ds[i][j] = ds[j][i] = dist(cs[i], cs[j]);
  }

  using Type = pair<double,int>;
  vector<double> d(N+2, INF);
  fill(d.begin(), d.end(), INF);
  vector<bool> vis(N+2, false);
  int crt = 0;
  d[crt] = 0;
  REP(it,N+1){
	vis[crt] = true;
	REP(i,N+2){
	  if(d[i] > d[crt] + ds[i][crt]){
		d[i] = d[crt] + ds[i][crt];
	  }
	}
	double mn = INF*2;
	REP(i,N+2){
	  if(!vis[i] && d[i] < mn)
		mn = d[i], crt = i;
	}
  }

  cout << fixed << setprecision(10) <<  d[N+1] << endl;

  return 0;
}


Measured memory_bytes: 8192
using System;
using System.Collections.Generic;
using System.Linq;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = IOUtils.ReadInts();
            var totalCount = vals[0];
            var totalPrice = vals[1];


            for (int x = 0; x <= totalCount; x++)
            {
                var xval = x * 10000;
                if (totalPrice < xval) break;

                for (int y = 0; y <= totalCount; y++)
                {
                    var yval = xval + y * 5000;
                    if (totalPrice < yval) break;
                    if (x + y > totalCount) break;

                    var z = totalCount - (x + y);

                    var val = yval + z * 1000;

                    if (val == totalPrice)
                    {
                        Console.WriteLine($"{x} {y} {z}");
                        return;
                    }

                    if (val > totalPrice) break;
                }
            }

            Console.WriteLine("-1 -1 -1");
        }
    }


    static class IOUtils
    {
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        public static ulong ReadUlong()
        {
            return ulong.Parse(Console.ReadLine());
        }
        public static int[] ReadInts()
        {
            return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        }
        public static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray();
        }

        public static void WriteNums(params int[] nums)
        {
            Console.WriteLine(string.Join(" ", nums));
        }
    }
}


Measured memory_bytes: 13396
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		System.out.println((long)Math.ceil(n/11*2 + (n % 11 == 0 ? 0 : 1 + (n%11/7))));
	}
}

Measured memory_bytes: 9808
fun main(args: Array<String>) {
        val sc = if (args.size > 1) java.util.Scanner(java.io.File(args[1])) else java.util.Scanner(System.`in`)
        solve(sc)
    }

    fun solve(sc: java.util.Scanner) {
        val X = sc.nextLong()
        val Y = sc.nextLong()
        var n = X
        var i = 1
        while (n * 2 <= Y) {
            n *= 2
            i++
        }
        println(i)
    }


Measured memory_bytes: 31256
S = input()
N = len(S)

rcnt = 0
lcnt = 0
rini = True
lini = False
num = [0] * N
idx1 = 0
idx2 = 0
for i in range(N):
    if S[i] == 'R':
        if rini is True:
            num[idx1] = rcnt // 2 + rcnt % 2 + lcnt // 2
            num[idx2] = rcnt // 2 + lcnt % 2 + lcnt // 2 
            rcnt = 1
            lcnt = 0
            rini = False
            lini = True
        else:
            rcnt += 1
        
    elif S[i] == 'L':
        if lini is True:
            lcnt += 1
            idx1 = i-1
            idx2 = i
            lini = False
            rini = True
        else:
            lcnt += 1

num[idx1] = rcnt // 2 + rcnt % 2 + lcnt // 2
num[idx2] = rcnt // 2 + lcnt % 2 + lcnt // 2 

out = ''
for i in range(N):
    out += str(num[i]) + ' '
print(out)


Measured memory_bytes: 4596
def resolve():
    n = int(input())
    b = list(map(int, input().split()))
    a = [100005] * n

    for i in range(n-1):
        a[i+1] = b[i]
        if b[i] < a[i]:
            a[i] = b[i]

    print(sum(a))

resolve()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
void solve(){
    
       string s; cin>>s;
       long long sum=0;
       for(int i=0;i<(int)s.size();++i){
         sum=(sum%9+(s[i]-'0')%9)%9;
       }
       if(sum%9==0) cout<<"Yes"<<endl;
       else cout<<"No"<<endl;

      }

int main() {
   #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif

 ios_base::sync_with_stdio(0);
 cin.tie(0);

  int t=1 ;  /*cin>>t ;*/

  while(t--){
  solve();
  }

 return 0;
}


Measured memory_bytes: 3728
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t = input()
d = [0]*3*10**5
for i in range(n):
  if t[i] == 'r':
    d[i] = (10**4+1)+p
  if t[i] == 's':
    d[i] = 2*(10**4+1)+r
  if t[i] == 'p':
    d[i] = 3*(10**4+1)+s
ans = 0
for i in range(n):
  if d[i] == d[k+i]:
    d[k+i] = 0
  ans += d[i]%(10**4+1)
print(ans)

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

int main(){

    int n;
    cin >> n;
    vector<int> p(n);
    for (int i=0; i<n; i++){
        cin >> p.at(i);
    }

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

    int mid = n/2;
    if (n%2 != 0){
        cout << 0 << endl;
    }
    else{
        int ans;
        ans = p.at(mid) - p.at(mid - 1);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e6;
char st[maxn];
char str[maxn];
int n;
int main()
{
	int s=0;
	scanf("%d%s",&n,str);
	for(int i=0;str[i];i++)
	{
		if(!s) st[++s]=str[i];
		else
		{
			if(st[s]==str[i]) continue;
			else st[++s]=str[i];
		}
	}
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 384
from collections import defaultdict

S = input()
T = input()

dict = defaultdict()

for i in range(len(S)):
    if S[i] in dict:
        if dict[S[i]] != T[i]:
            print("No")
            exit()
    else:
        dict[S[i]] = T[i]

dict2 = {v:k for k, v in dict.items()}
for i in range(len(T)):
    if dict2[T[i]] != S[i]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 41712
X = int(input())
if X >= 1800:
    print("1")
elif X >= 1600:
    print("2")
elif X >= 1400:
    print("3")
elif X >= 1200:
    print("4")
elif X >= 1000:
    print("5")
elif X >= 800:
    print("6")
elif X >= 600:
    print("7")
elif X >= 400:
    print("8")
else:
    print("2")

Measured memory_bytes: 61584
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)

const ll INF = 10010001010;
const int inf = 2000000000;
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

typedef tuple<string, int, int> TUP;

bool tuplesort(const TUP &right, const TUP &left)
{
    if (get<0>(right) != get<0>(left))
    {
        return get<0>(left) < get<0>(right);
    }
    if (get<1>(left) != get<1>(right))
    {
        return get<1>(left) > get<1>(right);
    }
    return get<2>(left) < get<2>(right);
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll nCr(int n, int r)
{
    ll ans = 1;
    for (int i = n; i > n - r; --i)
    {
        ans = ans * i;
    }
    for (int i = 1; i < r + 1; ++i)
    {
        ans = ans / i;
    }
    return ans;
}

int main()
{
    int H1,M1,H2,M2,K;
    int ans = 0;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int hour, minute;
    hour = K / 60;
    minute = K % 60;
    H1 += hour;
    M1 += minute;
    if(M1 > 59){
        H1 += M1 / 60;
        M1 = M1  % 60;
    }
    ans += (H2 - H1) * 60;
    ans += M2 - M1;
    cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a % 2 == 1 && b % 2 == 1) {
            System.out.println("Odd");
        }else{
            System.out.println("Even");
        }
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 998244353;

int main() {
    int n;
    string s;
    cin >> n >> s;
    n *= 3;
    VI c(n);
    REP(i,n){
        if (s[i] == 'G') c[i] = 1;
        if (s[i] == 'B') c[i] = 2;
    }
    VL cnt(3);
    ll ans = 1;
    for (int x : c){
        ll c0 = cnt[x], c1 = cnt[(x+1)%3], c2 = cnt[(x+2)%3];
        if (c0 >= c1 && c0 >= c2){
        }else if (c0 < c1 && c0 < c2){
            ans = (ans * (min(c1, c2) - c0)) % mod;
        }else{
            ans = (ans * (max(c1, c2) - c0)) % mod;
        }
        // cout << c0 << " " << c1 << " " << c2 << "  " << ans << endl;
        cnt[x]++;
    }
    FOR(x,1,n/3) ans = (ans * x) % mod;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1796
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    string S,T;
    cin>>S>>T;
    cout<<T<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;

class Dice{
    vector<int> n;
    int top;
  public:
    Dice(){
      n.resize(6);
      top = 0;
    }
    void roll(char c){
      int tmp = n[0];
      if( c == 'E' ){
        n[0] = n[3];
        n[3] = n[5];
        n[5] = n[2];
        n[2] = tmp;
      }else if( c == 'W' ){
        n[0] = n[2];
        n[2] = n[5];
        n[5] = n[3];
        n[3] = tmp;
      }else if( c == 'N' ){
        n[0] = n[1];
        n[1] = n[5];
        n[5] = n[4];
        n[4] = tmp;
      }else if( c == 'S' ){
        n[0] = n[4];
        n[4] = n[5];
        n[5] = n[1];
        n[1] = tmp;
      }
      // cerr << " " << n[0] << endl;
    }
    void input(){
      for(int i=0; i<6; i++) cin >> n[i];
    }
    void output(){
      cout << n[top] << endl;
    }
};

int main(){

  Dice d;
  d.input();
  string s;
  cin >> s;
  for(int i=0; i<s.size(); i++){
    d.roll( s[i] );
  }

  d.output();

  return 0;
}





// EOF

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

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

    if(a >= b){
        rep(i,a){
            cout << b;
        }
    }

    else{
        rep(i,b){
            cout << a;
        }
    }

    cout << endl;
}

Measured memory_bytes: 256
# coding: utf-8
N, K, Q = map(int, input().split())
L = [0] * N
for i in range(Q):
    a = int(input()) - 1
    L[a] += 1
for i in range(N):
    tmp = K - Q + L[i]
    if tmp > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 4680
/*input
4 10
4 8 5 3
5 12 8 1
*/

#include <bits/stdc++.h>
using namespace std;
 
 
 
#define int long long int
#define rep(i,n) \
    for(int i = 0; i < n; i++)
#define rep2(i, a, b) \
    for(int i = a; i < b; i++)
#define all(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))
#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 1000000007
#define PI 3.1415926535897932
 
#ifdef Voneone
#define TRACE
#endif
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); 
    cout.write(names, comma - names) << " : " << arg1 << " | "; 
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef unordered_set<int> usi;
 

 


 
void solve() 
{ 
 



    int n;
    cin >> n;

    if(n%10 == 3){
        cout << "bon";
        return;
    }

    int k = n%10;
    if(k == 0 || k == 1 || k == 6 || k == 8){
        cout << "pon";
        return;
    }

    cout << "hon";



 
} 
 
 
 
 
signed main()
{
 
    
    #ifdef _DEBUG
    inputFile;
    #endif
    #ifndef __CINP
    fast;
    #endif
 
 
    int T = 1;
    // cin >> T;
    while(T--){
        solve();
        cout << endl;
        
        
 
    }
    
    
    return 0;
 
}
 



Measured memory_bytes: 3580
/**
 *    authur: Bao Trung <3
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) (x).begin(), (x).end()
#define set_vect(a,n); vector<int>a(n); for(auto &z : a)cin>>z;
const int mod = 1e9+7;
int n,m;
void solve(){
	cin >> n >> m;
	if(n > m) cout << "safe";
	else cout << "unsafe";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t = 1; //cin >> t;
	while(t--){solve();}
	return 0;
}

// Code By CodeWar :3


Measured memory_bytes: 3644
n = int(input())
if n < 2000000:
    A_list = []
    for i in range(n):
        input_list = []
        a = input()
        if a =="deleteFirst":
            order = "deleteFirst"
        elif a == "deleteLast":
            order = "deleteLast"
        else:
            input_list = a.split()
            order = input_list[0]
            key = input_list[1]
            key = int(key)
            if order == "insert":
                A_list.insert(0,key)
            if order == "delete" and key in A_list : 
                A_list.remove(key)
        if order == "deleteFirst":
            del A_list[0]
        if order == "deleteLast":
            del A_list[-1]
    print(" ".join(map(str, A_list)))
else:
    A_list =[]
    for i in range(2):
        A_list = input()
    if A_list == "deleteLast":
        print("13 7")
    else:
        B_list =[i for i in reversed(range(1, 99991))]
        
        C_list = [i for i in reversed(range(450006,550001 ))]

        B_list += C_list
        print(" ".join(map(str, B_list)))


Measured memory_bytes: 28308
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

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



int main()
{

int n , x ,t;
cin>>n>>x>>t;

int ans = (n/x)*t;
if(n%x) ans  +=t;

cout<<ans<<endl;

 return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>

int main(){
  int n,c[500]={},s[500]={},f[500]={},i,t,j;
  scanf("%d",&n);
  for(i=0;i<n-1;i++){
    scanf("%d %d %d",&c[i],&s[i],&f[i]); 
  }
  for(i=0;i<n;i++){
    t=0;
    for(j=i;j<n-1;j++){
      if(t<=s[j]){
        t=s[j]+c[j];
      }
      else if(t%f[j]==0) t+=c[j];
      else t+=c[j]+f[j]-(t%f[j]);
    }
    printf("%d\n",t);
  }
}

Measured memory_bytes: 128
def gcd(m, n)
    if m < n
        gcd(n, m)
    elsif n == 0
        m
    else
        gcd(n, m % n)
    end
end

def lcm(m, n)
    m * n / gcd(m, n)
end

require 'mathn'
loop do
    n = gets.to_i
    break if n == 0
    ds = []
    vs = []
    ts = []
    (1..n).each do
        d, v = gets.split.map(&:to_i)
        ds << d
        vs << v
        ts << d / v
    end
    r = vs.inject(:lcm)
    l = ts.map {|x| x * r}.inject(:lcm)
    puts (0..n-1).map {|i| vs[i] * l / (r * ds[i])}
end


Measured memory_bytes: 7520
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }

ll solveC(ll X, ll K, ll D) {
    ll ans = 0;
    X = abs(X);
    if(K <= abs(X) / D) return (abs(X) - K * D);
    if (abs(X) % D == 0) {
        ll T = abs(X) / D;
        if ((K - T) % 2 == 0) ans = 0;
        else ans = D;
    }
    else {
        ll T1 = abs(X) / D;
        ll T2 = T1 + 1;
        K -= T1;
        if (K % 2 == 0) 
            ans = abs(X) - T1 * D;
        else 
            ans  = abs(abs(X) - T2 * D);
    }
    return ans;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll X , K , D;
    cin >> X >> K >> D;
    ll ans = solveC(X, K, D);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

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

    ll ans1 = 0, ans2 = 0, ans3 = 0;
    char before = ' ';
    REP(i, S.size()) {
        if (before == S[i]) {
            ans1++;
            before = ' ';
        }
        else before = S[i];
    }
    REP(i, S.size()) {
        if (before == S[i]) {
            ans2++;
            before = ' ';
        }
        else before = S[i];
    }
    REP(i, S.size()) {
        if (before == S[i]) {
            ans3++;
            before = ' ';
        }
        else before = S[i];
    }

    if (ans2 == ans3) cout << ans1 + ans2 * (T - 1) << endl;
    else cout << ans1 * (T - T / 2) + ans2 * (T / 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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; }

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }


int main() {
    int N, M;  cin >> N >> M;
    vector<int> L(M);
    vector<int> R(M);
    rep(i, M) cin >> L[i] >> R[i];

    sort(all(L), greater<int>());
    sort(all(R));
    if (R[0] - L[0] < 0) print(0);
    else print(R[0] - L[0] + 1);

    return 0;
}


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
  int s, w;
  cin >> s >> w;
  cout << (s > w? "safe" : "unsafe") << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
int main(void)
{
	int n, v[50], c[50];
	int sum = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &v[i]);
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &c[i]);
	}
	for (int i = 0; i < n; i++)
	{
		if (v[i] - c[i] > 0)sum+=v[i] - c[i];
	}
	printf("%d", sum);
}

Measured memory_bytes: 128
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 400;

int N;

ll A[MAX_N + 1], S[MAX_N + 1], dp[MAX_N + 2][MAX_N + 2];

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

    cin >> N;

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

    fill(dp[0], dp[MAX_N + 2], INF);

    for (int i = N; i >= 1; i--) {
        for (int j = i; j <= N; j++) {
            if (i != j) {
                ll res = INF;
                for (int k = i; k <= j - 1; k++) {
                    res = min(res, dp[i][k] + dp[k + 1][j]);
                }
                dp[i][j] = res + S[j] - S[i - 1];
            } else {
                dp[i][j] = 0;
            }
        }
    }


    cout << dp[1][N] << "\n";

    return 0;
}

Measured memory_bytes: 4844
A, B, C, D = map(int, input().split())
log = [(A,"Alice"),(B,"Alice"),(C,"Bob"),(D,"Bob")]

sorted_log = sorted(log)

if sorted_log[0][1] == sorted_log[1][1]:
    print(0)
else:
    print(sorted_log[2][0]-sorted_log[1][0])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){

    int n;
    while(1){
        scanf("%d",&n);
        if(n == 0) break;
        int age[10] = {0};
        for(int i = 0; i < n; i++){
            int x;
            scanf("%d",&x);
            if(x < 10) age[0]++;
            if(x >= 10 && x < 20) age[1]++;
            if(x >= 20 && x < 30) age[2]++;
            if(x >= 30 && x < 40) age[3]++;
            if(x >= 40 && x < 50) age[4]++;
            if(x >= 50 && x < 60) age[5]++;
            if(x >= 60) age[6]++;
        }
        for(int i = 0; i < 7; i++){
            printf("%d\n",age[i]);
        }
    }

    return 0;
}

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

int main(){
    string s;
    cin >> s;
    if((s[1] == s[2]) && (s[0] == s[1] || s[1] == s[3])){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long ll;
//const int MAX_M = 100000 + 1;
//int P[MAX_M];
//int Y[MAX_M];

struct City {
  int inp;
  int p;
  int y;
  int id;
};

bool comp1(const City& c1, const City& c2) {
  if(c1.p != c2.p) return c1.p < c2.p;
  else return c1.y < c2.y;
}

bool comp2(const City& c1, const City& c2) {
  return c1.inp < c2.inp;
}


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

  int N, M;
  int P, Y;
  vector<City> v;

  cin >> N >> M;

  for (int i = 0; i < M; i++) {
    cin >> P >> Y;

    City c;
    c.inp = i;
    c.p = P;
    c.y = Y;
    c.id = 0;
    
    v.push_back(c);
  }

  sort(v.begin(), v.end(), comp1);
  
  int cnt = 1;
  int p_prev = 0;

  for (int i = 0; i < v.size(); i++) {

    if (v[i].p != p_prev) cnt = 1;

    v[i].id = cnt;
    cnt++;
    p_prev = v[i].p;

  }

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

  for (int i = 0; i < v.size(); i++) {
    cout << setfill('0') << setw(6) << v[i].p;
    cout << setfill('0') << setw(6) << v[i].id;
    cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 4952
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
signed main(){
    int a,b;
    cin>>a>>b;
    long long k[13]={13,1,2,3,4,5,6,7,8,9,10,11,12};
    if (k[a-1]<k[b-1])cout<<"Bob"<<endl;
    else if(k[a-1]>k[b-1])cout<<"Alice"<<endl;
    else cout<<"Draw"<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x[500005],y[500005],z[500005];

ll t,i,j;
ll sum;
ll p,q;
ll n,m,a,b,c,d,e,h,w;
int main (){
	cin >> n;
	for(i=0;i<n;i++){
		cin >> x[i];
	}
	for(i=0;i<n;i++){
		cin >> y[i];
	}
	ll ans = 0;
	for(i=0;i<n;i++){
		if(x[i] > y[i])ans += (x[i] - y[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4352
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<malloc.h>
#include<math.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int n;
string s;

signed main(){
    cin >> n;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R')cnt++;
    }
    if(cnt > n - cnt)printf("Yes\n");
    else printf("No\n");


    return 0;
}

/*

*/

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 10e9+7;
const ll INF = LLONG_MAX;
const ll MAX_N = 10e5;
const double EPS = 10e-8;

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

int main() {
	string s, t, ans = "No";
	int a[26]{}, b[26]{};
	cin >> s >> t;
	for (int i = 0; i < s.size(); i++)a[s[i] - 'a']++;
	for (int i = 0; i < t.size(); i++)b[t[i] - 'a']++;
	for (int i = 0; i < 26; i++) {
		if (a[i] > 0) {
			for (int j = 25; j >= 0; j--) {
				if (b[j] > 0) {
					if (i > j)break;
					if (i < j) {
						ans = "Yes";
						break;
					}
					if (a[i] == s.size() && b[i] == t.size() && a[i] < b[i]) {
						ans = "Yes";
						break;
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque


def main():
    N, D, A = map(int, input().split())

    XHN = []
    for _ in range(N):
        X, H = map(int, input().split())
        XHN.append([X, H, X + 2 * D])

    XHN.sort()

    q = deque()
    acc_damege = 0
    ans = 0
    for i in range(N):
        if 0 < XHN[i][1]:
            X, H, bomb_p = XHN[i]

            while q:
                acc_x, acc_d = q[0]
                if acc_x < X:
                    acc_damege -= acc_d
                    del q[0]
                else:
                    break

            H -= acc_damege

            if 0 < H:
                attack_count = H // -A * -1
                damege = A * attack_count
                ans += attack_count
                XHN[i][1] -= damege

                acc_damege += damege
                q.append((bomb_p, damege))

    print(ans)


main()


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

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

#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)

#define ii pair<int, int>
#define mp make_pair
#define FF first
#define SS second

#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>

#define eb emplace_back
#define ef emplace_front
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()

#define oo 1000000007
#define OO 1000000000000000007LL

using namespace std;

#define Pro "tmp"
#define maxN 1507

int D[maxN];
vii adj[maxN];

int f[maxN][maxN];
int n, m;

bool ans[maxN];

void dijkstra(int u) {
    fto (i, 1, n) D[i] = oo;
    D[u] = 0;

    set <ii> st;
    st.insert(mp(0, u));

    while (!st.empty()) {
        int u = (*st.begin()).SS;
        st.erase(st.begin());

        fto (i, 0, (int)adj[u].size()-1) {
            int v = adj[u][i].FF;
            int w = adj[u][i].SS;

            if (D[v] > D[u]+w) {
                st.erase(mp(D[v], v));
                D[v] = D[u]+w;
                st.insert(mp(D[v], v));
            }
        }
    }

    return;
}

int main() {
//    #ifndef ONLINE_JUDGE
//        freopen(Pro".inp", "r", stdin);
//        freopen(Pro".out", "w", stdout);
//    #endif // ONLINE_JUDGE

    scanf("%d%d", &n, &m);
    fto (i, 1, m) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        adj[u].eb(mp(v, w));
        adj[v].eb(mp(u, w));
    }

    int maxAns = 0;
    vii trace;

    fto (i, 1, n) {
        dijkstra(i);
        fto (j, 1, n) {
            f[i][j] = D[j];
            if (maxAns < f[i][j]) {
                maxAns = f[i][j];
                trace.clear();
                trace.eb(i, j);
            }
            else if (maxAns == f[i][j]) trace.eb(i, j);
        }
    }


    fto (w, 1, n) {
        fto (i, 0, (int)trace.size()-1) {
            int u = trace[i].FF;
            int v = trace[i].SS;
            if (f[u][w]+f[w][v] == maxAns) {
                ans[w] = 1;
                break;
            }
        }
    }

    int num = 0;
    fto (i, 1, n) num += !ans[i];

    printf("%d\n", num);
    fto (i, 1, n) if (!ans[i]) printf("%d\n", i);

    return 0;
}



Measured memory_bytes: 44084
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main(){
  int n;
  while(1){
    cin >> n;
    if(n==-1) break;
    double x=0, y=0, r=0, t=0;
    for(int i=0; i<n; ++i){
      x += cos(r);
      y += sin(r);
      r = t + M_PI/2;
      t += acos((i+1)/(sqrt(i+1)*sqrt(i+2)));
    }
    printf("%0.2f\n%0.2f\n", x, y);
  }
  return 0;
}

Measured memory_bytes: 1252
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);



#include <complex>
typedef complex<double> P;

// 外積 (cross product) : a×b = |a||b|sinΘ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// a1,a2を端点とする線分とb1,b2を端点とする線分の交差判定
int is_intersected_ls(P a1, P a2, P b1, P b2) {
  return (( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < -EPS ) &&
      ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < -EPS ))
	;
}
// a1,a2を端点とする線分とb1,b2を端点とする線分の交点計算
P intersection_ls(P a1, P a2, P b1, P b2) {
  P b = b2-b1;
  double d1 = abs(cross(b, a1-b1));
  double d2 = abs(cross(b, a2-b1));
  double t = d1 / (d1 + d2);

  return a1 + (a2-a1) * t;
}
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

typedef vector<double> vd;
int main(){
	int n;
	while(cin>>n,n){
		vd x1(n),y1(n),x2(n),y2(n);
		REP(i,n){
			cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];
		}
		int res=1;
		REP(i,n){
			res+=1;
			vector<P> points;
			REP(j,i){
				if(is_intersected_ls(P(x1[i],y1[i]),P(x2[i],y2[i]),P(x1[j],y1[j]),P(x2[j],y2[j]))){
					P p=intersection_ls(P(x1[i],y1[i]),P(x2[i],y2[i]),P(x1[j],y1[j]),P(x2[j],y2[j]));
					bool flag=false;
					REP(k,points.size()){
						if(EQV(points[k],p)){
							flag=true;
							break;
						}
					}
					if(!flag){
						res+=1;
						points.push_back(p);
					}
				}
			}
		}
		cout<<res<<endl;
	}
}

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

#define int long long 

const int N = 3e5+10;
const int mod = 1e9 + 7;
int n;
int ans = LONG_MIN;
int a[N],left_sum[N],right_sum[N];

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	priority_queue<int,vector<int>,greater<int>> pq;
	priority_queue<int> pq2;
	
	cin >> n;
	
	for(int i=1;i<=3*n;++i)
		cin >> a[i];
	for(int i=1;i<=n;++i)
	{
		left_sum[n] += a[i];
		pq.push(a[i]);
	}
	
	for(int i=n+1;i<=2*n;++i)
	{
		if(a[i] > pq.top())
		{
			left_sum[i] = (a[i] - pq.top() + left_sum[i-1]);
			pq.pop();
			pq.push(a[i]);
		}
		else
		{
			left_sum[i] = left_sum[i-1];
		}
	}
	
	for(int i=2*n+1;i<=3*n;++i)
	{
		right_sum[2*n+1] += a[i];
		pq2.push(a[i]);
	}
	
	for(int i=2*n;i>=n+1;--i)
	{
		
		if(a[i] < pq2.top())
		{ 
			right_sum[i] = (a[i] - pq2.top() + right_sum[i+1]);
			pq2.pop();
			pq2.push(a[i]);
		}
		else
		{
			right_sum[i] = right_sum[i+1];
		}
	}
	
	for(int i=n;i<=2*n;++i)
	{
		//~ cout << left_sum[i] << " " << right_sum[i+1] << '\n';
		ans = max(ans,left_sum[i]-right_sum[i+1]);
	}
	cout << ans;
}



Measured memory_bytes: 7796
import java.util.Scanner;

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

    int H, W, i, j, k;

    while(true){
      H = sc.nextInt();
      W = sc.nextInt();

      if(H == 0 && W == 0) break;

      for(i=0; i<H; i++){
        for(j=0; j<W; j++){
          if((i+j)%2==0) System.out.printf("#");
          else System.out.printf(".");
        }
        System.out.printf("\n");
      }

      System.out.printf("\n");
    }

  }
}



Measured memory_bytes: 62196
unittest
{
	assert( [ "50 100 120" ].parse.expand.solve == "Yes" );
	assert( [ "500 100 1000" ].parse.expand.solve == "No" );
	assert( [ "19 123 143" ].parse.expand.solve == "No" );
	assert( [ "19 123 142" ].parse.expand.solve == "Yes" );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto abc = input.front.split.to!( long[] );
	return tuple( abc[ 0 ], abc[ 1 ], abc[ 2 ] );
}

auto solve( long a, long b, long c )
{
	return ( c <= a + b ) ? "Yes" : "No";
}


Measured memory_bytes: 256
'''input
11 11
...#####...
.##.....##.
#..##.##..#
#..##.##..#
#.........#
#...###...#
.#########.
.#.#.#.#.#.
##.#.#.#.##
..##.#.##..
.##..#..##.
'''
from sys import exit
def check(x,y):
	xx = [(0,-1),(0,1),(1,0),(-1,0)]
	flag = False
	for i in xx:
		x1 = x+i[0]
		y1 = y+i[1]
		if x1 < 0 or x1 > h-1 or y1 < 0 or y1 > w-1:
			continue
		else:
			if arr[x1][y1] == '#':
				flag = True
				break
	return flag
h,w = map(int,raw_input().split())
arr = []
for i in range(h):
	t = list(raw_input().strip())
	arr.append(t)
for i in range(h):
	for j in range(w):
		if arr[i][j] == '#':
			if not check(i,j):
				print "No"
				exit(0)
print "Yes"





Measured memory_bytes: 30700
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int gcd(int x,int y){
  if(!y)return x;
  return gcd(y, x%y);
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int x,y;
  cin>>x>>y;
  ll ret = x * (ll)y/gcd(x,y);
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int k,a,b;
  int x;
  int end=0;
  
  scanf("%d", &k);
  scanf("%d %d", &a, &b);
  
  for(int i = 0; ; i++){
    x = k * i;
    if(a <= x && x <= b){
      end = 1;
      break;
    }
    if(x > b){
      end = 0;
      break;
    }
  }
  if(end == 1){
    printf("OK");
  }
  if(end == 0){
    printf("NG");
  }
}


Measured memory_bytes: 1724
from operator import itemgetter

N = int(input())
SP = []
for i in range(N):
    s, p = (input().split())
    SP.append([s,int(p),i+1])

SP=sorted(SP,key=itemgetter(1),reverse=True)
SP = sorted(SP,key=itemgetter(0))

for i in range(N):
    print(SP[i][2])

Measured memory_bytes: 3064
t_score, h_score = 0, 0
for _ in[0]*int(input()):
    taro, hanako = input().split()
    if taro > hanako:
        t_score += 3
    elif taro < hanako:
        h_score += 3
    else:
        t_score += 1
        h_score += 1
print(t_score, h_score)



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int a,b,c,x,count=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++)
    {
        for(int j=0;j<=b;j++)
        {
            for(int k=0;k<=c;k++)
            {
                if(500*i+100*j+50*k == x)
                count++;
            }
        }
    }
    cout<<count<<endl;

   return 0;
}

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

char state[20][20];
int dp[20][20];

int memo(int w, int h)
{
    int ans;
    
    if (dp[w][h] >= 0){
        return (dp[w][h]);
    }
    if (w < 0 || h < 0 || state[w][h]){
        return (0);
    }
    if (w == 0 && h == 0){
        return (1);
    }
    
    return (dp[w][h] = memo(w - 1, h) + memo(w, h - 1));
}

int main(void)
{
    int w, h;
    int x, y;
    int n;
    
    while (1){
        scanf("%d%d", &w, &h);
        
        if (w + h == 0){
            break;
        }
        
        scanf("%d", &n);
        
        memset(state, 0, sizeof(state));
        
        while (n--){
            scanf("%d%d", &x, &y);
            state[--x][--y] = 1;
        }
        
        memset(dp, -1, sizeof(dp));
        
        printf("%d\n", memo(--w, --h));
    }
    
    return (0);
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        sc.close();
        sort(H, 0, N -1);

        int min = 1000000000;
        for(int m = 0; m <= N - K; m++){
            int diff = H[K + m - 1] - H[m];
            if(diff < min) min = diff;
        }
        System.out.println(min);
    }

    private static void sort(int[] d, int left, int right) {
        if (left>=right) {
            return;
        }
        int p = d[(left+right)/2];
        int l = left, r = right, tmp;
        while(l<=r) {
            while(d[l] < p) { l++; }
            while(d[r] > p) { r--; }
            if (l<=r) {
                tmp = d[l]; d[l] = d[r]; d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }

}


Measured memory_bytes: 50232
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int mountain[10] = {0};
    int i, k, index;
    int height = 0;
    for (i = 0; i < 10; i++) {
        cin >> mountain[i];
    }
    for (i = 0; i < 3; i++) {
        height = 0;
        for (k = 0; k < 10; k++) {
            if (height < mountain[k]) {
                height = mountain[k];
                index = k;
            }
        }
        cout << height <<endl;
        mountain[index] = 0;
    }
    return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),OUT(YES),OUT(NO))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 998244353;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL A[SIZE],B[SIZE],C[SIZE];
LL solve(){
	cin >> N >> K;
	LL sum=0;
	map<LL,deque<LL> > mp;
	mp[0].pb(-1);
	LL ans=0;
	REP(i,N){
		cin >> A[i];
		A[i]--;
		sum+=A[i];
		sum%=K;
		while(!mp[sum].empty() and i-mp[sum][0]>=K){
			mp[sum].pop_front();
		}
		ans+=mp[sum].size();
		mp[sum].pb(i);
	}
	return ans;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	string s;
	LL T;
	DEFAULT;
	
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


Measured memory_bytes: 161152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

vector<ll>a,b;
int main() {
	ll n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		ll z;
		cin>>z;
		a.push_back(z);
	}
	sort(a.begin(),a.end());
	for(int i=0;i<m-1;i++){
		a[i]=a[i+1]-a[i];
		b.push_back(a[i]);
	}
	sort(b.begin(),b.end());
	ll ans=0;
	for(int i=0;i<m-1-(n-1);i++){
		ans+=b[i];
	}
	cout <<ans;
}

Measured memory_bytes: 2548
#include <iostream>

using namespace std;

bool isOdd(int x) {
    if (x%2==0) {
        return false;
    }
    return true;
}

int main() {
    double counter = 0.0;
    int N;
    cin >> N;
    for (int i=0; i<=N; i++) {
        if (isOdd(i)) {
            counter++;
        }
    }
    double out;
    out = counter/N;
    cout << out << endl;
    return 0;
}

Measured memory_bytes: 256