akhauriyash/Code-Regression huggingface dataset:
//It doesn't matter how slow you go, Unless you don't stop.
#include<iostream>
#include<algorithm>
#include<bitset>
 
#include<cmath>
#include<cstring>
#include<climits>
 
#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
 
#include<fstream>
#include<chrono>
using namespace std;
 
typedef long long LL;
typedef pair<LL,LL> p64;
typedef vector<LL> v64;
typedef map<LL,LL> mp64;
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,s,e) for(long long i=s;i<=e;i++)
#define brep(i,s,e) for(long long i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
 
void solve()
{
     string s;cin>>s;
     if(s[0]=='7' || s[1]=='7' || s[2]=='7')
     {
         cout<<"Yes"<<endl;
     }
     else
     {
         cout<<"No"<<endl;
     }
}
 
int main()
{
    DANGER;
    ofstream out("output.txt");
 
    auto start = chrono::high_resolution_clock::now();
    
    LL t = 1;
    // cin>>t;
    rep(test,1,t)
    {
        solve();
    }
    
    auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<numeric>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> cnt(3);
    rep(i, 0, 3) {
        cin >> cnt[i];
    }
    int sum = accumulate(all(cnt), 0);
    rep(i, 0, 3) rep(j, i + 1, 3) {
        if (cnt[i] + cnt[j] == sum - cnt[i] - cnt[j]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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


int main () {

string s,t,u;
int a,b;

  cin >> s >> t >> a >> b >> u;
  
  if(u==s)
  {
	  a--;
  }
  else if(u==t)
  {
	  b--;
  }
  
  cout << a << " " << b;

	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
bool ts(string a,string b)
{
	int i;
	for(i=0;i<a.size();i++)if(a[i]!=b[i])return 0;
	return 1;
}
int main()
{
	string s,t;
	cin>>s>>t;
	if(t.size()-s.size()==1&&ts(s,t)==1)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3636
from itertools import permutations

n, m = map(int, input().split())
ss = []
for i in range(m):
    k, *s = map(int, input().split())
    ss.append(s)
p = list(map(int, input().split()))

ans = [0]
def dfs(l, depth):
    if depth== 0:
        for i in range(m):
            cnt = 0
            for j in ss[i]:
                if l[j-1]:
                    cnt += 1
            if cnt%2 != p[i]:
                return
        ans[0] += 1
        return
    q = l[::]
    q[depth-1] = 1
    dfs(l[::], depth-1)
    dfs(q, depth-1)
dfs([0]*n, n)
print(ans[0])

Measured memory_bytes: 3064
N=int(input())
H=list(map(int,input().split()))
mx=0
cnt=0
for i in range(1,N):
    if H[i]<=H[i-1]:
        cnt+=1
    else:
        if mx<cnt:
            mx=cnt
        cnt=0
    if i==N-1 and mx<cnt:
        mx=cnt
print(mx)

Measured memory_bytes: 14252
#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>
#include <iomanip>
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; }
#define INF 1LL<<60

int main() {
    int N;
    cin >> N;
    vector<queue<int>> Q(N, queue<int>());
    REP(i, N) REP(j, N-1){
        int tmp;
        cin >> tmp;
        tmp--;
        Q[i].push(tmp);
        }

    vector<int> last_access(N, -1);

    int day = 0, whole_comb = N*(N-1)/2;
    set<int> is_ready, not_ready;
    // for(int i=0; i<N; i++) not_ready.insert(i);
    for(int i=0; i<N; i++)
        if(Q[Q[i].front()].front() == i) {
            is_ready.insert(i);
            // not_ready.erase(i);
        }


    while(whole_comb > 0 && day < N*(N-1)/2) {
        // cerr << whole_comb << " " << day << endl;
        int tmp_whole_comb = whole_comb;

        set<int> is_ready_copy(is_ready);
        for(int i: is_ready_copy) {
            if(last_access[i] == day || Q[i].empty()) continue;
            int opp = Q[i].front();
            if(last_access[i] < day && last_access[opp] < day && Q[opp].front() == i) {
                Q[i].pop();
                Q[opp].pop();
                last_access[i] = day;
                last_access[opp] = day;
                whole_comb--;

                if(Q[Q[i].front()].front() != i) {
                    is_ready.erase(i);
                    // not_ready.insert(i);
                } else {
                    is_ready.insert(i);
                    is_ready.insert(Q[i].front());
                }

                if(Q[Q[opp].front()].front() != opp) {
                    is_ready.erase(opp);
                    // not_ready.insert(opp);
                } else {
                    is_ready.insert(opp);
                    is_ready.insert(Q[opp].front());
                }
            }
        }

        if(tmp_whole_comb==whole_comb) break;
        day++;
    }
    if(whole_comb > 0)
        cout << -1 << endl;
    else
        cout << day << endl;
    return 0;
}

Measured memory_bytes: 4736
# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

def main():
	s = "ACL"
	K = int(input())
	print(s * K)




if __name__ == '__main__':
	main()

Measured memory_bytes: 64684
import java.util.Scanner;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int y = 0;
    for(int x = a; x <= b; x++){
      if(c%x == 0){
        y = y+1;
      }
    }
    System.out.println(y);
  }
}


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

using namespace std;

void longest_path(int n, auto &gra, int curr, int ans[]) {
	
	if(gra[curr].size() == 0) {
		ans[curr] = 0; return;
	}

	int mx = 0, temp;
	for(int i=0; i<(int)gra[curr].size(); i++) {
		if(ans[gra[curr][i]] < 0) longest_path(n, gra, gra[curr][i], ans);
		
		temp = ans[gra[curr][i]];
		if(temp > mx) mx = temp;
	}

	ans[curr] = mx + 1;
}

int main() {
	
	int n, m;
	cin >> n >> m;
	vector < vector < int > > gra(n+1);
	for(int i=0; i<m; i++) {
		int t1, t2;
		cin >> t1 >> t2;
		gra[t1].push_back(t2);
	}

	int ans[n+1];
	memset(ans, -1, sizeof(ans));
	for(int i=1; i<=n; i++)
		if(ans[i] < 0)
			longest_path(n, gra, i, ans);

	int mx = 0;
	for(int i=1; i<=n; i++) 
		mx = max(mx, ans[i]);

	cout << mx << endl;
}

Measured memory_bytes: 9472
let mcm p n =
  let dp = Array.make_matrix (n + 1) (n + 1) max_int in
  for i = 0 to n do dp.(i).(i) <- 0 done;
  for d = 1 to n - 1 do
    for i = 1 to n - d do
      let j = i + d in
      for r = i to j - 1 do
        dp.(i).(j) <-
          min dp.(i).(j) (dp.(i).(r) + dp.(r+1).(j) + p.(i-1)*p.(r)*p.(j))
      done
    done
  done;
  dp.(1).(n)

let () =
  let n = read_int () in
  let p = Array.make (n + 1) 0 in
  for i = 0 to n - 1 do
    let (r, c) = Scanf.scanf "%d %d\n" (fun r c -> (r, c)) in
    p.(i) <- r;
    p.(i+1) <- c;
  done;
  mcm p n |> Printf.printf "%d\n"

Measured memory_bytes: 2464
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n, m; cin>>n>>m;
    vector<int> x(m);
    for(int i=0; i<m; i++) cin>>x[i];
    sort(x.begin(), x.end());

    vector<int> gap(m-1);
    for(int i=0; i<m-1; i++) gap[i]=x[i+1]-x[i];
    sort(gap.begin(), gap.end(), greater<int>());

    ll ans=0;
    for(int i=0; i<m-1; i++){
        if(n-1<=i) ans+=gap[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
n = int(input())
d = []
for _ in range(n):
  j = list(map(int, input().split()))
  d.append(j)
ok = True
for i in range(n - 2):
  if d[i][1] == d[i][0] and d[i + 1][1] == d[i + 1][0] and d[i + 2][1] == d[i + 2][0]:
    print("Yes")
    ok = False
    break
if ok:
  print("No")


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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin());
#define io() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
	io();
	int n; cin >> n;
	map<string, int> ump;
	int mx = -1;
	for(int i = 0; i < n; ++i){
		string s; cin >> s;
		++ump[s];
		if(ump[s] > mx){
			mx = ump[s];
		}
	}
	for(const auto &x : ump){
		if(x.second == mx) cout << x.first << '\n';
	}
	return 0;
}

Measured memory_bytes: 19200
module Main where

import Data.List (permutations)
import Data.Maybe (mapMaybe)
import Control.Monad
import qualified Data.Set as S
import qualified Data.IntSet as I
import Debug.Trace

data D = D I.IntSet Int Int -- indeces, length, additinal cost
  deriving (Show, Eq)

instance Ord D where
  D _ l _ <= D _ l' _ = l <= l'

main :: IO ()
main = do
  [n, a, b, c] <- map read . words <$> getLine :: IO [Int]
  ls <- replicateM n $ read <$> getLine :: IO [Int]
  print . minimum . mapMaybe (go (initSet n ls) 0) $ permutations [a, b, c]
    where
      initSet n ls = S.fromList [ (\(is, ls') -> 
        D (I.fromList is) (sum ls') ((length ls' - 1) * 10)) $ unzip ts 
        | ts <- concatMap (comb5 $ zip [1..] ls) [1..(n - 3 + 1)] ]
      go _ currentCost [] = Just currentCost
      go set currentCost (obj:objs) 
        | S.null set = Nothing
        | otherwise = 
          let 
            (is, cost) = getMinimum set obj 
            newSet = filterD is set
            newCost = currentCost + cost
          in go newSet newCost objs 
          where
            getMinimum :: S.Set D -> Int -> (I.IntSet, Int)
            getMinimum set obj = 
              let (D is l c) = S.findMin $ S.map (f obj) set -- when #bamboo is small, bamboos may dry up (and get RE)
              in (is, l)
              where
                f obj (D is l c) = D is ((abs (l - obj)) + c) c
            filterD :: I.IntSet -> S.Set D -> S.Set D
            filterD is set = 
              S.filter (\(D is' _ _) -> I.null $ is `I.intersection` is') set

comb5 :: [a] -> Int -> [[a]]
comb5 [] _ = [[]]
comb5 ns size = comb' size [(ns, [])]
    where
      comb' 0 xs = [a | (_, a) <- xs]
      comb' c xs = comb' (c - 1) $ concatMap comb'' xs
      comb'' (x : xs, ys) = (xs, ys ++ [x]) : comb'' (xs, ys)
      comb'' _ = []

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

using namespace std;

int main() {
  int N;
  long long K;
  cin >> N >> K;
  vector<long long> A(N);
  for (auto &a : A) cin >> a;
  sort(A.begin(), A.end());

  long long l = -1e18 - 1, r = 1e18 + 1;
  while (r - l > 1) {
    auto m = (l + r) / 2;
    long long cnt = 0;
    for (int i = 0; i < N; i++) {
      vector<long long>::iterator iter;
      if (A[i] == 0) {
        if (m >= 0) {
          cnt += N - 1;
        }
      } else if (A[i] > 0) {
        if (m > 0) {
          iter = upper_bound(A.begin(), A.end(), m / A[i]);
        } else {
          iter = upper_bound(A.begin(), A.end(), (m - A[i] + 1) / A[i]);
        }
        int idx = iter - A.begin();
        cnt += idx;
        if (i < idx) {
          cnt--;
        }
      } else {
        if (m > 0) {
          iter = lower_bound(A.begin(), A.end(), m / A[i]);
        } else {
          iter = lower_bound(A.begin(), A.end(), (m + A[i] + 1) / A[i]);
        }
        cnt += A.end() - iter;
        if (i >= iter - A.begin()) {
          cnt--;
        }
      }
    }
    cnt /= 2;
    if (cnt >= K) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r << endl;

  return 0;
}
/* vim:set fdm=marker: */


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

int main(void) {
  int n, x;
  cin >> n;
  vector<int> a(n);
  set<int> b;
  rep(i, n) {
    cin >> x;
    b.insert(x);
    a[i] = x;
  }
  cout << (a.size() == b.size() ? "YES" : "NO") << '\n';
  return 0;
}

Measured memory_bytes: 13504
#include <iostream>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define rep(i, a, n) for(int i = a; i <= n; i++)
#define sum(start, end) accumulate(start, end, 0)

typedef long long ll;


void solve() {
    int a, b;
    cin >> a >> b;
    cout << (a*b % 2 ? "Odd" : "Even");
}

int main() {	
    std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
    solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int d = 0;
int D[10002];
int topo[10002];
vector<int> E[10002];
void dfs(int A, int B) {
	if (!D[A]) {
		D[A] = B;
		topo[A] = d;
		d++;
		for (int i : E[A]) {
			dfs(i, B + 1);
		}
	}
}

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


	int N;
	cin >> N;
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		E[a].pb(b);
		E[b].pb(a);
	}

	int C[10002];
	int goukei = 0;
	int saidai = 0;
	rep(i, N) {
		cin >> C[i];
		goukei += C[i];
		saidai = max(saidai, C[i]);
	}
	sort(C, C + N);
	reverse(C, C + N);

	dfs(1, 1);
	co(goukei - saidai);
	rep1(i, N) {
		cosp(C[topo[i]]);
	}

	Would you please return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, a, b) for(ll (i)=(a);(i)<=(b);i++)
#define rFOR(i, a, b) for(ll (i)=(b);(i)>=(a);i--)
#define REP(i, n) for(ll i=0;i<n;i++)
using namespace std;

int main() {
  string S;
  cin>>S;
  int ans[4]={0};
  REP(i,S.size()){
    if (S[i]=='N')ans[0]+=1;
    else if (S[i]=='W')ans[1]+=1;
    else if (S[i]=='S')ans[2]+=1;
    else if (S[i]=='E')ans[3]+=1;
  }
  if ((ans[1]!=0&&ans[3]!=0&&ans[0]==0&&ans[2]==0)||(ans[1]==0&&ans[3]==0&&ans[0]!=0&&ans[2]!=0)||(ans[0]!=0&&ans[1]!=0&&ans[2]!=0&&ans[3]!=0)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  static int[] rank;
  static int[] par;
  static int[] weight;

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int q = sc.nextInt();

    rank = new int[n];
    par = new int[n];
    weight = new int[n];

    for(int i = 0 ; i < n ; i++) {
      par[i] = i;
    }

    int com, x, y, z;
    for(int i = 0 ; i < q ; i++) {
      com = sc.nextInt();
      x = sc.nextInt();
      y = sc.nextInt();
      if(com == 0) {
        z = sc.nextInt();
        realte(x, y, z);
      } else same(x,y);
    }
  }

  static int find(int x) {
    if(x == par[x]) return x;
    else {
      int r = find(par[x]);
      weight[x] += weight[par[x]];
      return par[x] = r;
    }
  }

  static int weight(int x) {
    find(x);
    return weight[x];
  }

  static void realte(int x, int y, int z) {
    z += weight(x);
    z -= weight(y);
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(rank[x] < rank[y]) {
      int swap = x;
      x = y;
      y = swap;
      z = -z;
    }
    if(rank[x] == rank[y]) {
      ++rank[x];
    }
    par[y] = x;
    weight[y] = z;
  }

  static void diff(int x, int y) {
    System.out.println(weight(y) - weight(x));
  }

  static void same(int x, int y) {
    if(find(x) == find(y)) {
      diff(x,y);
    } else {
      System.out.println("?");
    }
  }
}



Measured memory_bytes: 168124
import math

def is_even(x):
    if (x//2)*2 == x:
        return 1
    else:
        return 0

if __name__ == "__main__":
    N,K = map(int,input().split())
    Ks = [K]
    while K > 1:
        K = K/2
        Ks.append(math.ceil(K))
    L = len(Ks)
    for i in range(L):
        if Ks[i] <= N:
            b = i
            break
    prop = 0.0
    if b == 0:
        Ks.insert(0,N+1)
        for i in range(L):
            a = Ks[i] - Ks[i+1]
            c = a
            for i in range(i):
                c = c/2.0
            prop += c
    else:
        Ks.insert(b,N+1)
        for i in range(b,L):
            a = Ks[i] - Ks[i+1]
            c = a
            for i in range(i):
                c = c/2.0
            prop += c
    print(prop/N)

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <string> 
#include <cstdlib>/*絶対値取得*/
using namespace std;
#define MAX 200000

int main(){
    int n,l,r,i,sum=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>l>>r;
        sum+=(r-l+1);
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(n) for(int i=0; i<(int)(n); i++)
#define out(ans) cout << ans << endl;
#define outs(ans) cout << ans;
using ll = long long;

int main(){

    //imput n, a(n-1), b(n-1)
    int a, b;
    cin >>a >>b;
    

    //main process
    int ans= max(a,b);

    if(a==b){
        ans= ans+ a;
    }
    else{
        ans= 2*ans-1;
    }

out(ans);




}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int K; cin >> K;
    int A[] = {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};
    cout << A[K-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        ll g=__gcd(a,b);
        cout<<(a*b)/g<<endl;
    }
    return 0;
}


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

//型定義
typedef long long ll;

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

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

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

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

vector<int> a(1e+3+1),b(1e+3+1),c(1e+3+1,0);
auto dp=make_vec<int>(1e+3+1,pow(2,12));

int main(){
    int N,M;
    cin>>N>>M;
    
    int tmp;
    REP(i,M){
        cin>>a[i]>>b[i];
        REP(j,b[i]){
            cin>>tmp;
            tmp--;
            c[i]+=(1<<tmp);
        }
    }

    REP(i,M+1){
        REP(j,1<<N){
            if(j==0) dp[i][j]=0;
            else dp[i][j]=INF;
        }
    }
    int num;
    REP(i,M){
        REP(S,1<<N){
            dp[i+1][S]=min(dp[i][S],dp[i+1][S]); 
            dp[i+1][S|c[i]]=min(dp[i+1][S|c[i]],dp[i][S]+a[i]);       
            
        }
    }
    if(dp[M][(1<<N)-1]==INF) dp[M][(1<<N)-1]=-1;
    cout<<dp[M][(1<<N)-1]<<endl;

}

Measured memory_bytes: 16384
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int N, M, A[200009], B[200009], dega[200009], degb[200009]; char c[200009]; bool used[200009]; vector<int>X[200009];
queue<int>Q;

int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) cin >> c[i];
	for (int i = 0; i < M; i++) {
		cin >> A[i] >> B[i];
		X[A[i]].push_back(B[i]);
		X[B[i]].push_back(A[i]);
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < X[i].size(); j++) {
			if (c[X[i][j]] == 'A') dega[i]++;
			if (c[X[i][j]] == 'B') degb[i]++;
		}
		if (dega[i] <= 0 || degb[i] <= 0) { Q.push(i); used[i] = true; }
	}
	while (!Q.empty()) {
		int pos = Q.front(); Q.pop();
		for (int i = 0; i < X[pos].size(); i++) {
			if (c[pos] == 'A') dega[X[pos][i]]--;
			else degb[X[pos][i]]--;
			if ((dega[X[pos][i]] <= 0 || degb[X[pos][i]] <= 0) && used[X[pos][i]] == false) { 
				Q.push(X[pos][i]); used[X[pos][i]] = true;
			}
		}
	}
	for (int i = 1; i <= N; i++) {
		if (used[i] == false) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	string s;
	cin >> s;
	if(s == "#") break;
	char p = 'A';
	REP(i,s.size()){
	    if(p == 'A'){
		if(s[i] == '0') p = 'X';
		else p = 'Y';
	    }else if(p == 'X'){
		if(s[i] == '1') p = 'Z';
		else p = 'N';
	    }else if(p == 'Y'){
		if(s[i] == '0') p = 'X';
		else p = 'N';
	    }else if(p == 'Z'){
		if(s[i] == '1') p ='B';
		else p = 'W';
	    }else if(p == 'W'){
		if(s[i] == '0') p = 'B';
		else p = 'Y';
	    }else if(p == 'B'){
		if(s[i] == '1') p = 'X';
		else p = 'Y';
	    }
	}
	if(p == 'B') cout << "Yes" << endl;
	else cout << "No"<< endl;
    }
    return 0;
}

Measured memory_bytes: 1188
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

10
N = int(input())
divisors = make_divisors(N)
ans = float('inf')
div_len = len(divisors)
if div_len % 2 == 0:
    i = div_len // 2
    j = div_len // 2 - 1
    ans = divisors[i] + divisors[j] - 2
else:
    ans = divisors[div_len // 2] * 2 - 2
print(ans)

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

int n,m,ans;

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

	cin>>n;
	REP(i,n) {
		cin>>m;
		for(int j=1;j*j<=m;j++) {
			if((m-j)%(1+2*j)==0) goto flg;
		}
		ans++;
		flg:;
	}
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 3076
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#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 ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

template <class T>
void VecRowShow(vector<T> vec) {
	rep(i, vec.size()) {
		if (i != vec.size() - 1) cout << vec[i] << " ";
		else cout << vec[i] << endl;
	}
}

int main() {
	
	int n;
	cin >> n;
	vector<P> p;
	rep(i, n) {
		int j;
		cin >> j;
		p.push_back(mp(j, i));
	}
	SORT(p);
	rep(i, n) {
		if (i != n - 1) cout << p[i].second + 1 << " ";
		else cout << p[i].second + 1 << endl;
	}
}



Measured memory_bytes: 1780
#include <iostream>
using namespace std;
int main(){
	
	long n;
  	cin >> n;
  	long a[n];
  	for(int i=0; i<n; i++){
    	cin >> a[i]; 
    }
  	
 	int cnt = 0; //マイナスの値の数
    long sum = 0;
  	for(int i=0; i<n; i++){
    	if(a[i] < 0){
         	cnt ++;
          	a[i] *= -1;
        }
    }
  
    long min = 1000000000;
  	for(int i=0; i<n; i++){
      if(a[i] < min){
       	min = a[i]; 
      }
    }
  
  	for(int i=0; i<n; i++){
     	sum += a[i];
    }
  	
  	if(cnt % 2 == 1){
     	 sum -= min * 2;
    }
  
  
  	cout << sum  << endl;
  
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> v(n);
    rep(i,n) {
        int a;
        cin>>a;
        a--;
        v[a]++;
    }
    int ans = 0;
    sort(v.begin(),v.end());
    if(n<=k){
        cout<<0<<endl;
        return 0;
    }
    else{
        for(int i = 0;i<= n-k-1;i++){
            //cout<<v[i]<<" ";
            ans+=v[i];
        }

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

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    INT(n);
    VI p(n); VIin(p);
    int ans = 0;
    int m = p[0];
    rep(i,n){
        if(m >= p[i]) ans++;
        m = min(m,p[i]);
    }
    ANS;

    return 0;
}

Measured memory_bytes: 1792
n = int(input())
for i in range(n):
    left, right = [], []
    arr = map(int, input().split())
    for a in arr:
        if len(left) == 0 or left[-1] < a:
            left.append(a)
        elif len(right) == 0 or right[-1] < a:
            right.append(a)
        else:
            break
    if len(left) + len(right) == 10:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 7472
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
signed main()
{
   SPEED;
   int k;
   cin>>k;
   int a,b;
   cin>>a>>b;
   for(int i=a;i<=b;i++)
   {
       if(i%k==0)
       {
           cout<<"OK";
           return 0;
       }
   }
   cout<<"NG";
}

Measured memory_bytes: 3608
import qualified Data.ByteString.Char8 as C
import Data.Maybe
  ( fromJust )
import Data.List
  ( findIndex, minimumBy )
 
main = do
  _ <- getLine
  [t,a] <- getParm
  hs    <- getParm  
  print . findIndex4Minimum $ map (f t a . toEnum) hs
 
 
getParm :: IO [Int]
getParm = map (fst . fromJust . C.readInt) . C.words <$> C.getLine
 
f :: Int -> Int -> Int -> Double
f t a h = abs( (t'-h'*0.006) - a' )
  where
    t' = toEnum t
    h' = toEnum h
    a' = toEnum a
 
findIndex4Minimum :: [Double] -> Int
findIndex4Minimum ws = snd . minimumBy c . zip ws $ [1..]
  where
    c x y = compare (fst x) (fst y)

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


int main(){

  int N;
  cin >>N;
  
  string S;
  cin >>S;
  
  int x=0;
  int maxwk=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='I')
      x++;
    else
      x--;
 
    maxwk=max(maxwk,x);
  }
  
  cout << maxwk <<endl;
  
  return 0;
}

Measured memory_bytes: 256
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;
#pragma endregion

const int N = 100005;

pls give {
    AC;
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i=0; i<n; i++) cin >> arr[i];
    bool flag = false;
    for (auto i : arr) {
        if (i%2 == 0) {
            if ((i%3 != 0) and (i%5 != 0)) {
                cout << "DENIED";
                return 0;
            }
        }
    }
    cout << "APPROVED";
}

Measured memory_bytes: 256
program NOMURA2020C
implicit none
  integer(8)::N,i,j
  integer(8),allocatable::A(:),k(:),l(:)
  read(*,*)N
  allocate(A(0:N),k(0:N),l(0:N))
  read(*,*)A
  if(A(0)==0_8) then
     k(0)=1_8
  else if(A(0)==1) then
     k(0)=0_8
  else
     write(*,*)'-1'
     stop
  end if
  do i=1,N
     k(i)=k(i-1_8)*2_8-A(i)
     j=sum(A(i+1:N))
     if(k(i)>j) k(i)=j
     if((k(i)<=0_8 .and. i<N) .or. (k(i)<0_8 .and. i==N)) then
        write(*,*)'-1'
        stop
     end if
  end do
  l(N)=A(N)
  if(l(N)>k(N)+A(N)) then
     write(*,*)'-1'
     stop
     end if
  do i=N-1_8,0_8,-1_8
     l(i)=l(i+1)+A(i)
     if(l(i)>k(i)+A(i)) l(i)=k(i)+A(i)
     if(l(i)>k(i-1)*2 .and. i>0) l(i)=k(i-1)*2
  end do
  write(*,*) sum(l)
end program NOMURA2020C


Measured memory_bytes: 5508
import java.util.*;
public class Main {
public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] L = new int[N * 2];

    for(int i=0;i<N*2;i++){
        L[i] = sc.nextInt();
    }
    Arrays.sort(L);

//    System.out.println("N = " + N);
//    System.out.println("L = " + Arrays.toString(L));
    
    int cnt = 0;

    for (int j=0;j<N*2-1;j+=2){
        cnt += Math.min(L[j], L[j+1]);
    }
    System.out.println(cnt);

}
}

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

using namespace std;
typedef long long ll;

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif // LOCAL
    ll a, b;
    scanf("%lld%lld", &a, &b);
    int ans = 0;
//    a *= 2;
    while (a <= b) {
        ans++;
        a *= 2;
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 256
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();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int ans;
    if(a <= c){
      if(d <= b){
        ans = d - c;
      }else{
        ans = b - c;
      }
    }else{
      if(d <= b){
        ans = d - a;
      }else{
        ans = b - a;
      }
    }
    System.out.println(Math.max(ans, 0));
  }
}


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

int main() {
  ll N,Q,sum=0;
  vector<ll> cnt(100001,0);
  cin >> N;
  rep(i,N) {
    int a;
    cin >> a;
    cnt[a]++;
    sum += a;
  }
  cin >> Q;
  rep(i,Q){
    ll b,c;
    cin >> b >> c;
    sum += cnt[b]*(c-b);
    cnt[c] += cnt[b];
    cnt[b] = 0;
    cout << sum << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3832
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main (void){
    int N;
    char str[256];
    double x,sum;
    sum = 0.0;
    scanf("%d",&N);
    for(int i=0; i<N; i++){
        scanf("%lf",&x);
        scanf("%s", str);
        if(!strcmp(str,"JPY")){
            sum += x;
        }
        if(!strcmp(str,"BTC")){
            sum += 380000.0*x;
        }
    }
    printf("%lf\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdlib.h>

using namespace std;


int main() {
	long long N;
	cin >> N;
	int ans = 1;
	vector<long long>divisor = { N - 1 };
	for (long long K = 2; K*K <=N ; K++) {
		if (N%K == 0) {
			long long x = N / K;
			while (x%K == 0) {
				x /= K;
			}
			if (x%K == 1) {
				ans++;
			}
		}
	}
	for (long long K = 2; K*K <= N - 1; K++) {
		if ((N - 1) % K == 0) {
			divisor.push_back(K);
			if (K*K != (N - 1)) {
				divisor.push_back((N - 1) / K);
			}
		}
	}
	if (N - 1 >= 2)ans += divisor.size();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<list>
#include<climits>

using namespace std;
#define rep(i,i0,n) for(int i=(i0);i<(int)(n);++i)
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vii;
typedef long long ll;


int main(){
    int n,k;
    cin>>n>>k;
    int pos;
    rep(i,0,n){
        int a;cin>>a;
    }
    cout<<ceil((n-k)*1.0/(k-1))+1<<endl;
	return 0;
}



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

int const MAXN = 2e5;
int const MAXP = 1e4;
int N, P;
std::string S;

void calc_small() {
  int64_t dp1[2][MAXP];
  int64_t dp2[2];
  std::fill_n(dp1[0], P, 0);
  dp2[0] = 0;
  int d = S[0] - '0';
  dp1[0][d%P] = 1;
  for(int i = 1; i < N; ++i) {
    d = S[i] - '0';
    dp2[i%2] = dp1[(i-1)%2][0] + dp2[(i-1)%2];
    std::fill_n(dp1[i%2], P, 0);
    dp1[i%2][d%P] = 1;
    for(int p = 0; p < P; ++p) dp1[i%2][(p*10+d)%P] += dp1[(i-1)%2][p];
  }
  std::cout << dp1[(N-1)%2][0] + dp2[(N-1)%2] << std::endl;
}

int main() {
  std::cin >> N >> P >> S;
  if(P > 10) {
    int64_t dp[MAXP], ans = 0;
    int inv10 = 1, a = 1, b = 0;
    while(inv10*10%P != 1) ++inv10;
    int d = S[0] - '0';
    dp[d] = 1;
    ans = dp[b];
    for(int i = 1; i < N; ++i) {
      d = S[i] - '0';
      ++dp[b];
      (a *= inv10) %= P;
      (b += (P-a)*d) %= P;
      ans += dp[b];
    }
    std::cout << ans << std::endl;
  } else calc_small();
  return 0;
}


Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
using ll = long long;


int main() {
  int K;
  string S;
  cin >> K >> S;
  if(S.size()<=K) cout << S << endl;
  else{
    rep(i,K) cout << S.at(i);
    cout << "..." << endl;
  }
  return 0;
}

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

using namespace std;

#define ll long long
#define M 1000005
#define ii pair<ll, ll>
#define fi first
#define se second



int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    ll a, b, k;
    cin >> a >> b;
    if ((a + b) % 2 == 0) cout << (a + b)/2;
    else cout << "IMPOSSIBLE";
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    string a, b, ans = "EQUAL";
    cin >> a >> b;
    int n = a.size(), m = b.size();
    if(n>m) ans = "GREATER";
    else if(n<m) ans = "LESS";
    else{
        for (int i = 0; i < n; i++) {
            if(a[i] == b[i])continue;
            if(a[i] > b[i]){
                ans = "GREATER";
                break;
            }
            else{
                ans = "LESS";
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
#define pint pair<int,int>
#define vi(v) rep(i,v.size())cin >> v[i]
#define vc(v) rep(i,v.size())cout << v[i] << endl
#define ni(n) cin >> n
#define nc(n) cout << n << endl
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int solve(){
  int n;
  ni(n);
  vector<int>a(n),b(n),c(n);
  vi(a);
  vi(b);
  vi(c);
  sort(all(a));
  sort(all(c));
  ll ans = 0;
  rep(i,n){
    ll A = lower_bound(all(a),b[i]) - a.begin(),B = n - (upper_bound(all(c),b[i]) - c.begin());
    ans += A * B;
  }
  cout << ans << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}


Measured memory_bytes: 1408
N,M = (int(b) for b in input().split())
a = [0]*(N+1)
a[0] = 1
for i in range(M):
    x = int(input())
    a[x] = -1
for i in range(1,N+1):
    if a[i] == -1:
        continue
    a1 = max(a[i - 2], 0)
    a2 = max(a[i - 1], 0)
    a[i] = a1 + a2
print(a[N]%(1000000000+7))

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

int main(){
  double sum = 0;
  int n;
  std::cin>>n;
  for (int i = 0; i < n; i++){
    double temp;
    std::cin>>temp;
    std::string str;
    std::cin>>str;
    if(str == "JPY"){
      sum += temp;
    }else{
      sum += 380000.0 * temp;
    }

  }
  std::cout<<sum<<std::endl;

  return 0;


}


Measured memory_bytes: 256
//verma_ankit484

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
const int mod = (int) 1e9+7;

using namespace std;
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


int32_t main() {
  IOS
  #ifdef AV
  freopen("input.txt", "r", stdin);
  #endif
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans = 0;
  ans += min(a, k);
  k -= ans;
  k -= min(b, k);
  ans -= min(k, c);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

signed main(){
   IOS;
   char c; cin >> c;
   if(c>='A' and c<='Z') cout << "A\n";
   else cout << "a\n";  
}

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

using namespace std;

const int MAXN=2e5;
int houses[MAXN+10];

int main(){
    int K,N;
    scanf("%d%d",&K,&N);

    
    for(int i=0;i<N;i++) scanf("%d",houses+i);
    int longest_dist=K-houses[N-1]+houses[0];
    for(int i=0;i<N-1;i++) longest_dist=max(longest_dist,houses[i+1]-houses[i]);

    printf("%d\n",K-longest_dist);

    return 0;
}

Measured memory_bytes: 896
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n, m = Is()
A = LI()
s = sum(A)
c = s/(4*m)
# print(c)
count = 0
for a in A:
    if a * m * 4 >= s:
        count += 1
        # print(a)

if count >= m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 63724
s=input()
A=[s[i] for i in range(len(s))]
s=input()
B=[s[i] for i in range(len(s))]
s=input()
C=[s[i] for i in range(len(s))]

card = A.pop(0)
for _ in range(len(A)+len(B)+len(C)):
    if card=='a':
        if len(A)>0:
            card = A.pop(0)
        else:
            print("A")
            exit()
    elif card=='b':
        if len(B)>0:
            card = B.pop(0)
        else:
            print("B")
            exit()
    elif card=='c':
        if len(C)>0:
            card = C.pop(0)
        else:
            print("C")
            exit()

Measured memory_bytes: 3064
n=int(input())
M=set();A=set();R=set();C=set();H=set()
for i in range(n):
    a=input()
    if a.startswith("M"):
        M.add(a)
    elif a.startswith("A"):
        A.add(a)
    elif a.startswith("R"):
        R.add(a)
    elif a.startswith("C"):
        C.add(a)
    elif a.startswith("H"):
        H.add(a)
m=len(M);a=len(A);r=len(R);c=len(C);h=len(H)
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)

Measured memory_bytes: 14316
#include <iostream>

using namespace std;

int main()
{
    int a, b , c;

    cin >> a >> b >> c;

    if(b < a)
    {
    cout << 0;
    return 0;
    }
    int  max_num_snd = b / a;
    if(max_num_snd > c)
    {
        cout << c;
    }
    else
    {
        cout << max_num_snd;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		int n,i,j,a,maxv,minv;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int r[]=new int[n];
		for(i=0;i<n;i++){
			r[i]=Integer.parseInt(sc.next());
		}

		maxv=r[1]-r[0];
		minv=r[0];
		for(j=1;j<n;j++){
			maxv=Math.max(maxv, r[j]-minv);
			minv=Math.min(minv, r[j]);
		}

		System.out.println(maxv);


	}

}

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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}


//---------------------------------------------------------------

int main(){
  int K;
  cin>>K;
  ll ans = 0;
  REP(i,1,K+1){
    REP(j,1,K+1){
      REP(k,1,K+1){
        ans+=gcd(gcd(i,j),k);

      }

    }


  }














  cout<<ans<<endl;
}


Measured memory_bytes: 3624