akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ALDS1_3_D
{
    public class Program

    {
        public struct Pond
        {
            public int StartPoint { get; set; }
            public int Width { get; set; }


            public Pond(int startPoint, int width)
            {
                this.StartPoint = startPoint;
                this.Width = width;
            }

        }

        public static void Main(string[] args)
        {
            string line = ReadSt();
            Stack<Pond> ponds = new Stack<Pond>();
            Stack<int> areas = new Stack<int>();

            int width = 0;

            for (int i = 0 ; i < line.Length ; i++)
            {
                if (line[i] == '\\')
                {
                    areas.Push(i);
                }
                else if (line[i] == '/' && areas.Count > 0)
                {
                    int startPoint = areas.Pop();
                    width += i - startPoint;
                    while (ponds.Count > 0 && ponds.Peek().StartPoint > startPoint) //池の結合
                    {
                        Pond tmp = ponds.Pop();
                        width += tmp.Width;
                    }
                    ponds.Push(new Pond(startPoint, width));
                    width = 0;
                }
            }

            Console.WriteLine(ponds.Sum(x => x.Width));
            Console.WriteLine("{0}{1}", ponds.Count.ToString(), (ponds.Count > 0) ? " " + string.Join(" ", ponds.Select(x => x.Width.ToString()).Reverse().ToArray()): "");
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 20984
#include <stdio.h>
int main(void){
	int N,friend[100010]={0},a,b,i,ans;
	scanf("%d",&N);
	
	for(i=1;i<=N;i++){
		scanf("%d %d",&a,&b);
		friend[a]+=1;
		friend[b+1]-=1;
	}
	
	for(i=0;i<=N+1;i++){
		friend[i]+=friend[i-1];	
		if(i-1<=friend[i])
			ans=i-1;
	}
	
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 996
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
using namespace std;

typedef long long i64;
#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);(i)++)
#define RFOR(i,num,N) for(int (i)=(num);(i)>(N);(i)--)
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()

int main(){
    int N;
    cin>>N;
    i64 ans = 0;
    
    vector<long> A(N),B(N),C(N);
    FOR(i,0,N) cin>>A[i];
    FOR(i,0,N) cin>>B[i];
    FOR(i,0,N) cin>>C[i];

    sort(all(A));
    sort(all(C));

    FOR(i,0,N){
        long top = lower_bound(all(A),B[i]) - A .begin();
        long under = C.end() - upper_bound(all(C),B[i]);
        ans += (top*under);
    }
    put(ans);
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char **argv) {
    int N, M;
    cin >> N >> M;

    vector<pair<int, int>> sc;


    for (int i = 0; i < M; i++) {
        int s, c;
        cin >> s >> c;
        sc.push_back({s, c});
    }

    const int mins[] = {0, 0, 10, 100};
    int min = mins[N];
    const int maxs[] = {0, 9, 99, 999};
    int max = maxs[N];

    for (int i = min; i <= max; i++) {
        bool legit = true;
        for (auto sci : sc) {
            int si = sci.first;
            int ci = sci.second;
            int candidate = i;
            for (int k = 0; k < N - si; k++) {
                candidate /= 10;
            }
            candidate %= 10;
            if (ci != candidate) {
                legit = false;
                break;
            }
        }
        if (legit) {
            cout << i << endl;
            return 0;
        }
    }

    cout << (-1) << endl;
    return 0;
}


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

using namespace std;

int main() {
    long long h, w, a, b;
    cin >> h >> w >> a >> b;

    long long mod_n = 1000000007;
    vector<long long> inv(h + w + 1, 0), frac(h + w + 1, 0), frac_inv(h + w + 1, 0);
    inv[1] = 1;
    frac[0] = frac[1] = 1;
    frac_inv[0] = frac_inv[1] = 1;
    for (int i = 2; i <= h + w; i++) {
        inv[i] = mod_n - (inv[mod_n % i] * (mod_n / i)) % mod_n;
        frac[i] = (frac[i - 1] * i) % mod_n;
        frac_inv[i] = (frac_inv[i - 1] * inv[i]) % mod_n;
    }

    long long res = 0;
    for (int i = b; i < w; i++) {
        res += ((((frac[(h - a - 1) + i] * frac_inv[h - a - 1]) % mod_n) * frac_inv[i]) % mod_n)
                * ((((frac[(a - 1) + (w - i - 1)] * frac_inv[a - 1]) % mod_n) * frac_inv[w - i - 1]) % mod_n);
        res %= mod_n;
    }

    cout << res << endl;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll h,w;
  cin >> h >> w;
  vector<string> a(h);
  REP(i,h) cin >> a[i];
  vector<bool> count(h+w,false);
  bool judge = true;
  REP(i,h){
    REP(j,w){
      if(a[i][j]=='#'){
        if(count[i+j]){
          judge = false;
          break;
        }else{
          count[i+j] = true;
        }
      }
    }
    if(!judge) break;
  }
  if(judge) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const ll INF = 9223372036854775807;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    int N;
    cin >> N;
    vector<string> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    int ret = 0;
    for(int i = 0;i < N;i++) {
        for(int j = 0;j < vec[i].size() - 1;j++) {
            if(vec[i].at(j) == 'A' && vec[i].at(j + 1) == 'B') {
                ret++;
            }
        }
    }
    int A = 0;
    int B = 0;
    int C = 0;
    for(int i = 0;i < N;i++) {
        if(vec[i].at(0) == 'B' && vec[i].at(vec[i].size() - 1) == 'A') {
            A++;
        }
        else if(vec[i].at(0) != 'B' && vec[i].at(vec[i].size() - 1) == 'A') {
            B++;
        }
        else if(vec[i].at(0) == 'B' && vec[i].at(vec[i].size() - 1) != 'A') {
            C++;
        }
    }
    if(A == 0) {
        ret += min(B,C);
    }
    else {
        if(B + C > 0) {
            ret += A + min(B,C);
        }
        else {
            ret += A - 1;
        }
    }
    cout << ret << endl;
}

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

vector<ll> memo(90);
vector<bool> done(90,false);
ll luca(ll n){
  if(n==0) return 2;
  if(n==1) return 1;
  if(done[n]) return memo[n];
  done[n]=true;
  return memo[n]=luca(n-1)+luca(n-2);
}

int main(){
  ll n;
  cin>>n;
  cout<<luca(n)<<endl;
  return 0;
}

Measured memory_bytes: 3640
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	d := make([]int, n)
	for i := range d {
		fmt.Scan(&d[i])
	}

	m := make(map[int]bool)
	for _, v := range d {
		m[v] = true
	}
	fmt.Println(len(m))
}


Measured memory_bytes: 512
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e7 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int p = 7;
   int cur = 1;
   int n;
   cin >> n;
   while(cur <= N){
      p %= n;
      // debug(p);
      if(p == 0){
         cout << cur << '\n';
         return 0;
      }
      cur++;
      p = p*10+7;
   }
   cout << -1;
   return 0;
} 


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  ll A,V,B,W,T;
  cin>>A>>V>>B>>W>>T;
  if(V<=W){
    cout<<"NO"<<endl;
    return 0;
  }
  if(abs(A-B)<=T*(V-W)){
    cout<<"YES"<<endl;
    return 0;
  }
  cout<<"NO"<<endl;
}


Measured memory_bytes: 3624
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
 
from functools import reduce
# from math import *
from fractions import *
N, M = map(int, readline().split())
A = list(sorted(map(lambda x: int(x) // 2, readline().split())))
min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)
 
# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))
if not all(map(lambda x: (min_cm // x) % 2 == 1, A)):
    print(0)
    exit(0)
if min_cm > M:
    print(0)
    exit(0)
ans = (M // min_cm + 1) // 2
print(ans)

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

int n, m, b, c, sx[50], sy[50], cx[50], cy[50];
int main(){
	cin >> n >> m;
	for(int i = 0; i < n; i++) cin >> sx[i] >> sy[i];
	for(int i = 0; i < m; i++) cin >> cx[i] >> cy[i];
	for(int i = 0; i < n; i++){
		b = INT_MAX;
		for(int j = 0; j < m; j++){
			if(abs(sx[i]-cx[j])+abs(sy[i]-cy[j]) < b){
				b = abs(sx[i]-cx[j])+abs(sy[i]-cy[j]);
				c = j+1;
			}
		}
		cout << c << "\n";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    string S,T;
    cin >> S >> T;
    int ans = S.size();
    for(auto i = 0; i < S.size() - T.size()+1; i++) {
        int tmp = 0;
        REP(j,T.size()) {
            if (S[i+j] != T[j]) tmp++;
        }
        ans = min(ans,tmp);
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    var(int, N, L);
    vector<string> a(N);
    read(a);

    sort(all(a));
    rep(i, 0, N) {
        cout << a[i] ;
    }
    print();

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  bool ans = 0;
  char a[55][55],b[55][55];
  for(int i=0;i<n;++i)
    for(int j=0;j<n;++j)
      cin>>a[i][j];
  for(int i=0;i<m;++i)
    for(int j=0;j<m;++j)
      cin>>b[i][j];
  [&](){
	  for(int i=0;i<=n-m;++i){
        for(int j=0;j<=n-m;++j){
          bool fl=1;
          for(int k=i;k<i+m;++k){
            for(int l=j;l<j+m;++l){
              if(a[k][l]!=b[k-i][l-j]){
                fl=0;
                break;
              }
              if(!fl)break;
            }
            if(!fl)break;
            if(k==i+m-1){
              ans=1;
              return;
            }
          }
        }
      }
  }();
      cout<<(ans?"Yes":"No")<<endl;
  }
          
    
      

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define MAX 2000

int n,m,h,k;
int t[MAX][MAX];
int change[MAX];
int u[MAX];
vector<int> G[MAX],A,B;

void compute(){
  for(int i=0;i<n;i++)t[h][i]=i;

  for(int i=h-1;i>=0;i--){
    for(int j=0;j<n;j++)t[i][j]=t[i+1][j];
    for(int j=0;j<(int)G[i].size();j++){
      int w=G[i][j];
      swap(t[i][w],t[i][w+1]);
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<(int)G[i].size();j++){
      int w=G[i][j];
      A.push_back(t[i][w]);
      B.push_back(t[i][w+1]);
    }
  }
  //for(int i=0;i<=h;i++){    for(int j=0;j<n;j++){
  //  cout<<t[i][j]<<" ";    }    cout<<endl;  } cout<<endl;
  
}

void solve(){  
  compute();
  int mini=0;
  for(int i=0;i<k;i++)mini+=u[t[0][i]];
  for(int i=0;i<(int)A.size();i++){
    swap(u[A[i]],u[B[i]]);
    int sum=0;
    for(int j=0;j<k;j++) sum+=u[t[0][j]];
    mini=min(mini,sum);
    swap(u[A[i]],u[B[i]]);
  }
  cout<<mini<<endl;
}

void init(){
  A.clear();
  B.clear();
  for(int i=0;i<MAX;i++)G[i].clear();
}

int main(){
  while(1){
    cin>>n>>m>>h>>k;
    if(n==0&&m==0&&h==0&&k==0)break;
    h--;
    init();
    for(int i=0;i<n;i++)cin>>u[i];
    for(int i=0;i<m;i++){
      int a,b;
      cin>>a>>b;
      a--,b--;
      G[b].push_back(a);
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 10868
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
//#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

int n;
int a[55];

int main()
{
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n;
    forn(i, n) cin >> a[i];
    int ans = 0;
    forn(i, n) for(int j = i+1; j<n; j++) ans += a[i] * a[j];
    cout << ans << endl;
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			int n = Integer.parseInt(br.readLine());
			Map<String, Integer> map = new HashMap<>();
			int max = 0, tmp = 0;
			for (int i = 0; i < n; i++) {
				String s = br.readLine();
				tmp = (map.containsKey(s)) ? map.get(s) + 1 : 1;
				map.put(s, tmp);
				max = Math.max(max, tmp);
			}
			List<String> list = new ArrayList<>();
			for (String key : map.keySet()) if (map.get(key) == max) list.add(key);
			Collections.sort(list);
			PrintWriter out = new PrintWriter(System.out);
			for (String s : list) out.println(s);
			out.flush();
		}
	}
}

Measured memory_bytes: 57000
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
    string s = scan;
    if(s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" || s == "hihihihihi") "Yes".writeln;
    else "No".writeln;
}



Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
j = 0
u = []
v = [0]*4
for i in l:
    if not i in u :
        u.append(i)
    v[u.index(i)] += 1
    if len(u) > 3:
        break
#print(u,v)
if len(u) == 3:
    if ((n%3 == 0) and (u[0] ^ u[2] == u[1]) and (v[0] == v[1] and v[1] == v[2]) and not len(u) > 3 and not 0 in u):
        j = 1
elif len(u) == 2:
    if 0 in u:
        if u[0] == 0 :
            b = u[1]
        else :
            b = u[0]
        if v[u.index(0)] * 2 == v[u.index(b)]:
            j = 1
if len(u) == 1:
    if u[0] == 0:
        j = 1

if j == 1 :
    print("Yes")
else :
    print("No")

#print(l[0] ^ l[2] == l[1],n == 3)
"""01
10
11
01
10
11

01
00
01
01
00
01
"""


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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  double w, h, x, y; cin >> w >> h >> x >> y;
  cout << setprecision(16) << fixed << w*h/2.0 << ' ';
  if ((x*2==w) && (y*2==h)) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}

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

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

  vector<int> d(n);
  for(int i=0; i<n ; ++i){
    cin >> d[i];
  }
  //ソートする
  sort(d.begin(), d.end());

  //存在しない場合
  if((d[n/2]-d[n/2 -1]) < 1)ans = 0;
  else{
    ans = d[n/2]-d[n/2 -1] ;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int N;
  cin >> N;
  
  int frag = 0;
  for (int i = 0; i < N; i++) { 
    string S;
    cin >> S;
    if (S == "Y") {
      frag = 1;
      break;
    }
  }
  
  if (frag) cout << "Four";
  else cout << "Three";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
int main() {
string s;
cin>>s;
if(s.length()==19){
    for (int i = 0; i <s.length() ; ++i) {
        if(s[i]==','){
            s[i]=' ';
        }
        cout<<s[i];
    }
}
   return 0;
}

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

int main(){
  string s;
  cin >> s;

  if(s == "Sunny") cout << "Cloudy" << endl;
  if(s == "Cloudy") cout << "Rainy" << endl;
  if(s == "Rainy") cout << "Sunny" << endl;

  return 0;

}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
for i in range(N):
    if i % 2 == 0:
        A = max(a)
        Alice = Alice + A
        a.remove(A)
    else:
        A =max(a)
        Bob = Bob + A
        a.remove(A)
print(Alice - Bob)

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()
{

    ll n, k;
    cin >> n >> k;
    vector<ll> v(n);
    for(ll i = 0; i < n; i++) cin >> v[i];
    sort(all(v));
    reverse(all(v));
    ll ans=0;
    for(ll i = 0; i < k; i++) ans+=v[i];
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 5;
ll a[maxn];
ll s[maxn * 10],c[maxn * 10];
ll n;
ll lowbit(ll x)
{
	return x & (-x);
}
ll query(ll x)
{
	ll sum = 0;
	for(;x;sum += c[x],x -= lowbit(x));
	return sum;
}
void update(ll x)
{
	for(;x <= maxn * 2;c[x]++,x += lowbit(x));
}
bool check(ll x)
{
	memset(c,0x00,sizeof(c));
	s[0] = 0;
	for(ll i = 1;i <= n; ++i)
	{
		s[i] = s[i - 1] + (a[i] >= x ? 1 : -1);
	}
	ll sum = 0;
	for(ll i = 0;i <= n; ++i)
	{
		sum += query(s[i] + maxn);
		update(s[i] + maxn);
	}
	return sum >= n * (n + 1) / 4;
}
int main()
{
	cin >> n;
	ll left = 0,right = 0;
	for(ll i = 1;i <= n; ++i)
	{
		scanf("%lld",&a[i]);
		right = max(right,a[i]);
	}
	right++;
	while(left+1<right){
		ll mid = (left+right)>>1;
		if(check(mid)) left = mid;
		else right = mid;
	}
	cout << left << endl;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll k,a,b;
  cin>>k>>a>>b;
  bool ans = false;
  for(int i=a;i<=b;++i)if(i%k==0)ans=true;
  cout<<(ans?"OK":"NG")<<endl;

}

Measured memory_bytes: 3632
s=input()
if s[0]=="A" and s[2:-1].count("C")==1 and s[1]==s[1].lower() and s[1:s.find("C")]==s[1:s.find("C")].lower() and s[s.find("C")+1:]==s[s.find("C")+1:].lower() :
    print("AC")
else: print("WA")

Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  N, M = parseMap(split(readline()))
  ks = [parseMap(split(readline())) for i = 1:M]
  p = parseMap(split(readline()))
  ans = 0
  
  for bit = 0:(1<<N - 1)
    ok = true
    for i = 1:M
      n = 0
      for v in ks[i][2:end]
        (bit & (1<<(v-1))) != 0 && (n += 1)
      end
      (n%2 != p[i]) && (ok = false)
    end
    ok && (ans += 1)
  end
  println(ans)
end

main()

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int n;cin>>n;
	if(n/100==7||(n/10)%10==7||n%10==7)puts("Yes");
	else puts("No");
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());



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

	int n;
	cin >> n;
	int v[n+1][3];
	FOR(i,1,n) {
		For(j,3) {
			cin >> v[i][j];
		}
	}

	int dp[n+1][3];
	memset(dp, 0, sizeof dp);
	FOR(i,1,n) {
		For(j,3) {
			For(k,3) {
				if (j==k) continue;
				dp[i][j] = max(dp[i][j], dp[i-1][k] + v[i][j]);
			}
		}
	}
	cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << nl;

	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
int m,d;
cin >> m >> d;
  int ans = 0;
    for(int j = 22; j <= d; j++){
      int t = j;
      int x = t%10;
      t /= 10;
      int y = t%10;
      if(x>1 && y>1 && x*y <= m) ans++;
    }
  cout << ans << endl;
}


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

int main(){
    int X, N;
    cin >> X >> N;
    vector<int> P(N);
    for (int i = 0; i < N; i++) {cin >> P.at(i);}
    
    bool judge = false;
    int i = 0;
    int ans = 0;
    while (!(judge)) {
        if (!(find(P.begin(), P.end(), X + i) != P.end())) {
            ans = X + i;
            judge = true;
        }
        if (!(find(P.begin(), P.end(), X - i) != P.end())) {
            ans = X - i;
            judge = true;
        }
        i++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  int N, K, Q, x;
  cin >> N >> K >> Q;
  vector<int> a(N, 0);

  for (int i = 0; i < Q; i++) {
    cin >> x;
    a[x - 1]++;
  }

  for (int i = 0; i < N; i++) {
    // cout << a[i] + K << endl;
    if (0 < K + a[i] - Q) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

}


Measured memory_bytes: 1024
#include<stdio.h>

int main(void){
  int i,t,sum=0;
  scanf("%d",&t);
  i=t;
  while(t!=0){
    sum+=t%10;
    t/=10;
  }
  if(i%sum==0) {
    puts("Yes");
  }else{
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iomanip>
#include <ios>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;

#define INF (1e9)

int N, M;

int main() {
    cin >> N >> M;

    int p, y;
    vector<tuple<int, int, int> > PYi(M);
    for (int i = 0; i < M; i++) {
        cin >> p >> y;
        PYi[i] = make_tuple(p, y, i);
    }

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

    int lastP = -1, count;
    for (int i = 0; i < M; i++) {
        if (lastP != get<0>(PYi[i])) {
            count = 1;
            lastP = get<0>(PYi[i]);
        }
        get<1>(PYi[i]) = count;
        count++;
    }

    sort(PYi.begin(), PYi.end(), [](const tuple<int, int, int> &left, const tuple<int, int, int> &right) {
        return get<2>(left) < get<2>(right);
    });

    for (int i = 0; i < M; i++) {
        cout << setfill('0') << right << setw(6)
             << get<0>(PYi[i]);

        cout << setfill('0') << right << setw(6)
             << get<1>(PYi[i]) << endl;
    }

    return 0;
}


Measured memory_bytes: 2688
#include <algorithm>
#include <iostream>
#include <queue>
#include <queue>
#include <stdio.h>
#include <string>

using namespace std;

void solve(int N, vector<int> d) {
  sort(d.begin(), d.end());
  int l = d[N / 2 - 1];
  int r = d[N / 2];
  cout << r - l << endl;
}

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }
  solve(N, d);
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int solve(int n, int q) {
    vector<int> dates(101, 0);
    int k, d;
    for(int i=0;i<n;++i) {
        cin >> k;
        for(int j=0;j<k;++j) {
            cin >> d;
            ++dates[d];
        }
    }

    int max_n = 0, ret = 0;
    for(int i=1;i<=100;++i) {
        if(max_n < dates[i]) {
            max_n = dates[i];
            ret = i;
        }
    }
    if(max_n < q) ret = 0;
    return ret;
}

int main() {
    int n,q;
    while(cin >> n >> q && n) {
        cout << solve(n, q)<< endl;
    }
}


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

int main()
{
    long long X, K, D;
    cin >> X >> K >> D;

    X = abs(X);
    long long k = min(X / D, K);
    K -= k;
    X -= D * k;
    if (K % 2 == 0)
    {
        cout << X << endl;
    }
    else
    {
        cout << abs(X - D) << endl;
    }
}


Measured memory_bytes: 3628
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long K = sc.nextLong();
		
		if(N > K)N = N % K;
		System.out.println(Math.min(N, Math.abs(N-K)));
	}
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vector<vp> v(n);
    rep(i,m) {
        int p,y;
        cin >> p >> y;
        p--;
        v[p].eb(y,i);
    }
    vs ans(m);
    rep(i,n) {
        sort(all(v[i]));
        string f = to_string(i+1);
        while(f.size() < 6) f = '0'+f;
        rep(j,v[i].size()) {
            string s = to_string(j+1);
            while(s.size() < 6) s = '0'+s;
            ans[v[i][j].second] = f+s;
        }
    }
    rep(i,m) cout << ans[i] << endl;
}

Measured memory_bytes: 12416
#include <iostream>

using namespace std;

int main()
{
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if (s==u)
        cout<<a-1<<" "<<b;
    else
        cout<<a<<" "<<b-1;
        
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {


	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		while(in.hasNext()){
			int a[] = new int[4], b[] = new int[4];
			for(int i=0; i<4; i++) a[i] = in.nextInt();
			for(int i=0; i<4; i++) b[i] = in.nextInt();
			System.out.println(countHit(a,b) + " " + countBlow(a,b));
		}
	}
	
	static int countHit(int[] a, int[] b){
		int cnt=0;
		for(int i=0; i<4; i++)if(a[i] == b[i]) cnt++;
		return cnt;
	}
	
	static int countBlow(int[] a, int[] b){
		int cnt=0;
		for(int i=0; i<4; i++)if(a[i] != b[i])
			for(int j=0; j<4; j++)if(i!=j && a[i] == b[j]){
				cnt++;
				break;
			}
		return cnt;
	}
}

Measured memory_bytes: 11000
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

struct hms {		// ツ篠楪甘板、ツ閉ェツ、ツ秒ツつェツ与ツつヲツづァツづェツつスツづつォツづ個計ツ算ツ陛「ツ渉閉。ツ秒ツづ可環キツ算ツ。ツ青ョツ青板氾。
  int t;
  int h, m, s;
  hms(int _h, int _m, int _s) {h=_h;m=_m;s=_s;t=h*3600+m*60+s;}
  hms(int _t) {t = _t; h = t/3600; m = t%3600/60; s=t%60;}
};
ostream &operator<<(ostream &stream, hms ob) {
  stream << ob.h << " " << ob.m << " " << ob.s;
  return stream;
}

int main() {
  REP(i,3) {
    int a,b,c,d,e,f;
    cin >>a>>b>>c>>d>>e>>f;
    cout << hms(hms(d,e,f).t-hms(a,b,c).t) << endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#include<chrono>
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define MIN3(a,b,c)         MIN(a,MIN(b,c))
#define MAX3(a,b,c)         MAX(a,MAX(b,c))
#define MIN4(a,b,c,d)       MIN(a,MIN(b,MIN(c,d)))
#define MAX4(a,b,c,d)       MAX(a,MAX(b,MAX(c,d)))
#define MAX5(a,b,c,d,e)     MAX(MAX3(a,b,c),MAX(d,e))
#define MIN5(a,b,c,d,e)     MIN(MIN3(a,b,c),MIN(d,e))
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void DFS(int n);
bool isprime(ll n);
ll gcd(ll a,ll b);
void rstgraph(int n);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================================================================================
vector<vector<int>> list;
vi g[N];
int vis[N];
int nodes=0;
void iluzn() {
 int ac=0,wa=0,tle=0,re=0;
 string s;
 int n;
 cin>>n;
 while(n--){
  cin>>s;
  switch(s[0]){
    case 'A':++ac;break;
    case 'W':++wa;break;
    case 'T':++tle;break;
    case 'R':++re;break;
  }
 }
 cout<<"AC x "<<ac<<endl;
 cout<<"WA x "<<wa<<endl;
 cout<<"TLE x "<<tle<<endl;
 cout<<"RE x "<<re<<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), cout.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) {
      iluzn();
      }
    return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(ll n){
    if(n<=1)
        return false;
    if(n==2)
        return true;
    if(n%2==0)
        return false;
    ll rt = sqrt(n);
    for(ll i=3;i<rt;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}
ll gcd(ll a,ll b){
    if(a%b){
        return gcd(b,a%b);
    }
    else{
        return b;
    }
}
void ipgraph(int m){
  int u, v;
  while(m--){
    cin>>u>>v;
    g[u].pb(v);
    g[v].pb(u);
  }
}

void DFS(int n)
{  ++nodes;
    vis[n] = 1;
    for(vector<int>::iterator i = g[n].begin(); i != g[n].end() ; i++)
    {
        if(!vis[*i])
            DFS(*i);
    }
}
void rstgraph(int n){
  int i;
  fo(i,n+1){
    g[i].clear();
    vis[i]=0;
  }
  nodes=0;
}

Measured memory_bytes: 10640
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
typedef long long ll;
#define FOR(i,n) for(int i=0;i<n;i++)
//map<key,value>

int main(){
  int a,b;
  cin >> a >> b;
  cout << max(max(a+b,a-b),a*b);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
li_a = list(map(int, input().split()))
q = int(input())

li_b = [list(map(int, input().split())) for _ in range(q)]

ans = [0]*10**6

sum = 0
for i in li_a:
    ans[i] += 1
    sum += i

    
for i in range(q):
    b = li_b[i][0]
    c = li_b[i][1]
    
    cnt = ans[b]
    ans[b] = 0
    ans[c] += cnt
    
    sum += (c-b)*cnt
    print(sum)

Measured memory_bytes: 39392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)

/////////////////////////////////////////////////////////

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

ll lcm(ll a, ll b){
  if(a > b) return b * (a / gcm(a, b));
  else return a * (b / gcm(a, b));
}

void Main(){
  int N; cin >> N;
  vector<ll> T(N);
  rep(i, 0, N) cin >> T[i];
  ll t = T[0];
  rep(i, 1, N){
    t = lcm(t, T[i]);
  }
  cout << t << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vb vector<bool>
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=s; i>=e; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<ll>())
#define arrasort(arr,n) sort(arr,arr+n)
#define arrdsort(arr,n) sort(arr,arr+n,greater<ll>())

#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define mz(a,val)   memset(a,val,sizeof(a))
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007

void file()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

// code starts here


int main()
{
    //file();

    ll t;
    t = 1;

    //cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        ll ac = 0, wa = 0, tle = 0, re = 0;
        while (n--)
        {
            string s;
            cin >> s;
            char c = s[0];
            if (c == 'A')
                ac++;
            else if (c == 'W')
                wa++;
            else if (c == 'T')
                tle++;
            else
                re++;
        }
        cout << "AC x " << ac << endl;
        cout << "WA x " << wa << endl;
        cout << "TLE x " << tle << endl;
        cout << "RE x " << re << endl;


    }
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }

int main() {
    string s, t;
    cin >> s >> t;

    int n = s.size(), m = t.size();
    if (n < m) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    for (int i = n-m; i >= 0; i--) {
        bool match = true;
        for (int j = 0; j < m; j++) {
            if (s[i+j] != '?' && s[i+j] != t[j]) {
                match = false;
                continue;
            }
        }

        if (match) {
            for (int j = 0; j < m; j++) {
                if (s[i+j] == '?') s[i+j] = t[j];
            }
            rep(k, n) {
                if (s[k] == '?') s[k] = 'a';
            }
            cout << s << endl;
            return 0;
        }
    }

    cout << "UNRESTORABLE" << endl;
}


Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        try {
            int N = Integer.parseInt(br.readLine());
 
            String array[] = br.readLine().split("\\s+");
 
            System.out.printf("%d",Integer.parseInt(array[array.length-1]));
            for(int i = array.length-2; i >= 0; i--){
                System.out.printf(" %d", Integer.parseInt(array[i]));
            }
            System.out.printf("\n");
 
 
        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


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

int main() {
  ll N,M;
  cin >> N >> M;
  ll ans;
  if (N == 1 && M == 1) ans = 1;
  else if (N == 1) ans = M - 2;
  else if (M == 1) ans = N - 2;
  else ans = (N-2) * (M-2);
  
  cout << ans << endl; 
}

Measured memory_bytes: 256
//ABC144_C問題
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[]) {
    double n,sq,sel,sum;

    scanf("%lf",&n);
    sq = sqrt(n) ;
    sum = n+1;

    for(double i=1; i<=sq; i++){
        if(fmod(n,i)==0){
            sel = n / i;
            if(sum >= i +sel){
                sum = i + sel;
            }
        }
    }
    printf("%1.0lf\n",sum-2);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
// 上下左右用
const int hmax = 50;
const int wmax = 50;

int main() {
  int H, W;
  cin >> H >> W;

  //vector<vector<char>> s(H, vector<char>(W));
  char s[wmax][hmax];
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> s[i][j];
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(s[i][j] == '#'){
        int cnt = 0;
        for(int x = 0; x < 4; x++){
          if(s[i+dx[x]][j+dy[x]] == '#') cnt++;
        }
        if(cnt == 0){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;

}


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

int main()
{
	unsigned length[10]={};
	for(int i=0; i<10; ++i)
	{
		cin >> length[i];
	}
	sort(begin(length), end(length), greater<unsigned>());
	cout << length[0] << '\n' << length[1] << '\n' << length[2] << '\n';
}

Measured memory_bytes: 1168
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
s = input()
maxx = 0
for i in range(n-1):
    x = s[:i+1]
    y = s[i+1:]
    ans = set(x) & set(y)
    ansans = len(ans)
    maxx = max(maxx, ansans)
print(maxx)


Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI   3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	string s;
	cin >> s;
	for(ll i = 1; i < s.size(); i ++){
		if(s[i] == s[i-1]){
			cout << "Bad";
			return 0;
		}
	}
	cout << "Good";
	return 0;
}

Measured memory_bytes: 3628