akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 




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


int main() {
    string s, t; cin >> s >> t;
    if(sz(s) < sz(t)){
        co("UNRESTORABLE");
        return 0;
    }
    for(int i = sz(s)-sz(t); i >= 0; i--){
        bool f = true;
        rep(j, 0, sz(t)){
            if(s[i+j] == '?'){
            }else{
                if(s[i+j] != t[j]) f = false;
            }
        }
        if(f){
            rep(j, 0, sz(t)){
                s[i+j] = t[j];
            }
            break;
        }
        if(i == 0){
            co("UNRESTORABLE");
            return 0;
        }
    }
    rep(i, 0, sz(s)){
        if(s[i] == '?') s[i] = 'a';
    }
    co(s);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 51;
int main()
{
  int n,m,a,b,i;
  int c[N_MAX];
  cin >> n >> m;
  fill(c,c+n+1,0);
  for(i=0;i<m;i++){
    cin >> a >> b;
    c[a]++;
    c[b]++;
  }
  for(i=1;i<=n;i++)
    cout << c[i] << endl;
  return 0;
}

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

using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  int distance;
  distance = N % K;
  if(distance == 0){
      cout << distance << endl;
  }
  else {
      cout << 1 << endl;
  }
  
  return 0;
}

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

using namespace std;

struct Block {
    int a, b, x;
    friend istream& operator>>(istream& in, Block& block) {
        int s, t;
        in >> s >> t >> block.x;
        block.a = 2*s-1-2*block.x;
        block.b = 2*t-1-2*block.x;
        return in;
    }
};

bool first_start(const Block& b1, const Block& b2) {
    if (b1.a == b2.a) {
        return make_pair(b1.x, b1.b) < make_pair(b2.x, b2.b);
    }
    return b1.a < b2.a;
}

bool first_end(const Block& b1, const Block& b2) {
    if (b1.b == b2.b) {
        return make_pair(b1.a, b1.x) < make_pair(b2.a, b2.x);
    }
    return b1.b < b2.b;
}

bool first_x(const Block& b1, const Block& b2) {
    if (b1.x == b2.x) {
        return make_pair(b1.a, b1.b) < make_pair(b2.a, b2.b);
    }
    return b1.x < b2.x;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<Block> blocks(n);
    for (auto& block : blocks) {
        cin >> block;
    }
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_a(first_start);
    blocks_by_a.insert(blocks.begin(), blocks.end());
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_b(first_end);
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_x(first_x);
    while (q --> 0) {
        int d;
        cin >> d;
        d *= 2;
        while (blocks_by_a.size() > 0 && blocks_by_a.begin()->a < d) {
            blocks_by_b.insert(*blocks_by_a.begin());
            blocks_by_x.insert(*blocks_by_a.begin());
            blocks_by_a.erase(blocks_by_a.begin());
        }
        while (blocks_by_b.size() > 0 && blocks_by_b.begin()->b < d) {
            blocks_by_x.erase(*blocks_by_b.begin());
            blocks_by_b.erase(blocks_by_b.begin());
        }
        if (blocks_by_x.size() == 0) {
            cout << -1 << "\n";
        } else {
            cout << blocks_by_x.begin()->x << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 28672
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>
#include <cmath>

#define MOD 1000000007

using namespace std;

typedef long long ll;

typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vl> vvl;
typedef vector<vi> vvi;

typedef pair<ll, ll> pll;
typedef pair<int, int> pi;

typedef vector<pll> vpl;
typedef vector<pi> vpi;

typedef queue<ll> ql;
typedef queue<int> qi;

template <class T>
void printv(vector<T> vc)
{
    for (auto e : vc)
        cout << e << " ";
    cout << endl;
}

template <class T>
void printvv(vector<T> vvc)
{
    for (auto vc : vvc)
    {
        for (auto e : vc)
            cout << e << " ";
        cout << endl;
    }
}

template <class T>
void printvp(vector<pair<T, T>> vp)
{
    for (auto pT : vp)
        cout << pT.first << " " << pT.second << endl;
}

int main()
{
    string s;
    cin >> s;
    int c = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '1') ++c;
    }
    cout << c << endl;
    return 0;
}


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

int main(){
  std::string str;
  std::string comp;

  std::cin >> str;
  std::cin >> comp;

  str = str + str;
  if ( str.find(comp) == -1) std::cout << "No" << std::endl;
  else std::cout << "Yes" << std::endl;

  return 0;
}



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

using namespace std;


#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define mp make_pair
#define pb push_back
#define eps 1e-9
#define PI acos(-1.0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<int, pii> iii;
typedef vector<pii> vii;
typedef long double ld;
// const int INF = 1e9 + 5;
const ll INF = 1e18L + 5;

bool prime(ll x)
{
    if(x == 2)
        return true;
    for(int i = 2 ; i * i <= x ; i++)
        if(x % i == 0)
            return false;
    return true;
}
void self_max(ll& a, ll b)
{
    a = max(a, b);
}
void self_min(ll& a, ll b)
{
    a = min(a, b);
}
bool cmp(int a, int b)
{
    return a > b;
}
int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    // ios_base::sync_with_stdio (0);
    // cin.tie(0);

    int n, w, sum_val = 0;
    cin >> n >> w;
    std::vector<int> wt(n), val(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> wt[i] >> val[i];
        sum_val += val[i];
    }
    std::vector<ll> dp(1e5 + 5, INF);
    dp[0] = 0;
    for (int item = 0; item < n; ++item)
    {
        for (ll val_alrdy = sum_val - val[item]; val_alrdy >= 0; --val_alrdy)
        {
            self_min(dp[val_alrdy + val[item]], dp[val_alrdy] + wt[item]);
        }
    }
    ll ans = 0;
    for (int i = 0; i <= sum_val; ++i)
    {
        if(dp[i] <= w)
        self_max(ans, (ll)i);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin>>n;
  LL ma,sum;
  ma=sum=0;
  REP(i,0,n){
    LL t;
    cin>>t;
    ma=max(ma,t);
    sum+=t;
  }
  sum-=ma;
  Yes(ma<sum);

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int w = sc.nextInt();
    String ans = "";

    for (int i = 0; i < s.length(); i += w) {
      ans += s.charAt(i);
    }

    System.out.println(ans);

  }
}

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

int  n , m  , Max=0;

vector<int > a[100010];

int  dp[100005];

void dfs(int  x , int  root , int  i)
{
    if(dp[x]!=0){return;}
    for(auto v: a[x])
    {
        if(v!=root&&v!=i)
        {
            dfs(v , x , i);
            dp[x]=max(dp[v]+1 , dp[x]);
        }
    }
}

main()
{
    cin >> n >> m ;
    for(int  i=1 ; i<=n ; i++){
        dp[i]=0;
    }
    for(int  i=1 ; i<=m ; i++){
        int  u , v;
        cin >> u >> v;
        a[u].push_back(v);
    }
    for(int  i=1 ; i<=n ; i++)
    {
        dfs(i , -1 , i);
        Max=max(dp[i] , Max);
    }
    cout << Max<<endl;
    
}



Measured memory_bytes: 12532
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); }

int main() {
    int a, b;
    while (scanf("%d%d", &a, &b) != EOF) {
        const int g = gcd(a, b);
        printf("%d %d\n", g, a/g*b);
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
const int maxn = 1e5+500;
int flag[100]={0};
int main()
{
	int m,d;
	scanf("%d%d",&m,&d);
	int cnt=0;
	for(int i=1;i<=m;i++){
		for(int j=2;j<10;j++){
			for(int k=2;k<10;k++){
				if(j*10+k>d){
					break;
				}
				if(j*k==i){
					cnt++;
				//	cout<<j<<" "<<k<<endl;
				//	flag[i]=1;
				}
			}
		}
	}
	cout<<cnt<<endl;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 300005;

/* ...o(^-^)o... */

int main(){
    string n; cin >> n;
    if(n[0] == '7' || n[1] == '7' || n[2] == '7') out("Yes");
    else out("No");
}

Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <locale>
using namespace std;
#define FORN(i,m,n) for(int i=m; i<(n); i++)
#define PRINTVEC(v) FORN(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define PRINTMAT(m) FORN(j,0,m.size()) {PRINTVEC(m[j]);}
#define p_b(x) push_back(x)
#define m_p(a,b) make_pair(a,b)
typedef long long ll;

int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int n; cin>>n;
  vector<ll> city(n+1), hero(n);
  ll sum = 0, newsum = 0;
  FORN(i,0,n+1) {
    cin>>city[i];
    sum += city[i];
  }
  FORN(i,0,n) cin>>hero[i];
  FORN(i,0,n){
    int dif;
    dif = min(city[i],hero[i]);
    city[i] -= dif;
    hero[i] -= dif;
    dif = min(city[i+1],hero[i]);
    city[i+1] -= dif;
    hero[i] -= dif;
  }
  FORN(i,0,n+1) newsum += city[i];
  cout<<sum-newsum<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define pb(n) push_back(n);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
vector<int> vi;
vector<lln> vl;
vector<pii> vii;
vector<pll> vll;


int arr[maxii];
int arr2[maxii];
bool check[maxii];
bool check2[1000][1000];
int n,m;
int x[]={1,-1,0,0};
int y[]={0,0,-1,1};
int x2[]={1,-1,0,0,1,-1,1,-1};
int y2[]={0,0,-1,1,1,-1,-1,1};
int bx[]={0,0,1,-1,-1,1,1,-1};
int by[]={1,-1,0,0,-1,-1,1,1};
int kx[] = {1,1,2,2,-1,-1,-2,-2};
int ky[] = {2,-2,1,-1,2,-2,1,-1};

bool isvisited(int x,int y)
{
    if(x<1 || y<1 || x>n ||y>m)
    {
        return false;
    }
    else if(check2[x][y]==true)
    {
        return false;
    }
    else true;
}
int gcd(int a,int b)
{
    if(b==0){
      return a;
     }
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    int res=(a*b)/gcd(a,b);
    return res;
}
int po(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b%2!=0)
        {
            res*=a;
            b--;
        }
        else
        {
            a*=a;
            b/=2;
        }
    }
    return res;
}

lln modMul(lln  a, lln b,lln mod){
    lln ans = 0;
    a = a % mod;
    while (b > 0){
        if ( b % 2 )ans = (ans%mod+ a%mod) % mod;
        a = (a%mod * 2%mod) % mod;
        b /= 2;
    }
    return ans % mod;
}
lln powerMod(lln a,lln b,lln mod){
	if(b==0)return 1LL%mod;
	lln x=powerMod( a,b/2,mod );
	x = ( x%mod * x%mod ) % mod;
	if( b%2==1 )x = ( x%mod * a%mod ) % mod;
	return x%mod;
}

int main()
{
    int n;
    cin>>n;
    int mini=99999999,maxi=0;
    for(int i=0;i<n;i++)
    {
        sc(arr[i]);
        mini=min(mini,arr[i]);
        maxi=max(maxi,arr[i]);
    }
    cout<<maxi-mini;

}




Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int a,b,c;
	int step=0;
	cin>>a>>b>>c;
	while(a%2==0&&b%2==0&&c%2==0)
	{
		step++;
		if(a==b&&b==c){
			cout<<-1<<endl;
			return 0;
		}
		else{
			int tempA=a/2,tempB=b/2,tempC=c/2;
			a=tempB+tempC;
			b=tempA+tempC;
			c=tempA+tempB;
		}
	}
	cout<<step<<endl;
	return 0;
}

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

using namespace std;

// Common DS shorteners
using ll = long long; using ull = unsigned long long;
using pii = pair<int, int>; using pll = pair<ll, ll>;
template <typename T> using vec = vector<T>;
template <typename K, typename V> using mp = unordered_map<K, V>;
template <typename K> using us = unordered_set<K>;
using vi = vec<int>; using vl = vec<ll>; using vpi = vec<pii>; using vpl = vec<pll>;
// Shorthand Macros
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define mpr make_pair
#define pb push_back
// Shorthand Functions
template<typename T> inline void maxa(T& st, T v) { st = max(st, v); }
template<typename T> inline void mina(T& st, T v) { st = min(st, v); }
// Out operators and printing for arrays and vectors
template <typename T> ostream& operator<<(ostream& out,vector<T> iter){out<<"[";for(auto t:iter){out<<t<<", ";}out<<"]";return out;}
template <typename T> void printDebug(T *arr,int sz){cout<<"[";for(int i=0;i<sz;i++){cout<<arr[i]<<", "; } cout<<"]\n";}
template <typename T> void printArray(T *arr,int sz){for(int i=0;i<sz;i++){cout<<arr[i]<<" "; } cout<<"\n";}
#define OUT_OPERATOR(type, propa, propb) ostream& operator<<(ostream& out,type obj){out<<"("<<#propa<<"="<<obj. propa<<", "<<#propb<<"="<<obj. propb<<")";return out;}
// I/O Operations
inline void scan(){}
template<typename F, typename... R> inline void scan(F &f,R&... r){cin>>f;scan(r...);}
inline void println(){cout<<"\n";}
template<typename F, typename... R> inline void println(F f,R... r){cout<<f<<" ";println(r...);}
inline void print(){}
template<typename F, typename... R> inline void print(F f,R... r){cout<<f;print(r...);}
// Debugging
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R>
void debug_(F f,R... r){int bc=0;while (bc != 0 || dnms_[di_] != ','){if (dnms_[di_] == '(') {bc++;}else if (dnms_[di_] == ')') {bc--;}cout << dnms_[di_++];}di_++;cout << ": " << f << ",";debug_(r...);}
#define debug(...) do{dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__);}while(0)

const int MN = 51;
int n;
double vals[MN];

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

    scan(n);

    for (int i = 0; i < n; i++)
        scan(vals[i]);
    sort(vals, vals + n);

    double ans = vals[0];
    for (int i = 1; i < n; i++) {
        ans += vals[i];
        ans /= 2.;
    }

    cout << fixed << setprecision(10) << ans;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		int c = A - B * 2;
		System.out.println(c > 0 ? c : 0);
	}

}

Measured memory_bytes: 23764
#include<stdio.h>

int main(void)
{
   int n, p[20], i, x;

   scanf("%d",&n);
   for(i=0;i<n;i++)
      scanf("%d",&p[i]);

   for(i=1;i<n-1;i++)
      if(((p[i-1]<p[i])&&(p[i+1]>p[i]))||((p[i-1]>p[i])&&(p[i+1]<p[i])))
         x++;

   printf("%d\n",x);
   return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args){

		String str = null;
		BufferedReader br = null;
		br = new BufferedReader(new InputStreamReader(System.in));
		
		boolean b = true;
		String[] str1;
		int n1,n2;
		
		for(;b;){
		
		try {
			str = br.readLine();
		} catch (IOException e) {
			// TODO ????????????????????? catch ????????????
			e.printStackTrace();
		}
		
		
		str1 = str.split(" ");
		n1 = Integer.parseInt(str1[0]);
		n2 = Integer.parseInt(str1[1]);
		
		if(n1==0 && n2==0){
			b = false;
			break;
			}
		
		if(n1>n2){
		System.out.println(n2+" "+n1);
		}else{
			System.out.println(n1+" "+n2);
		}
		
		
		}
		
	}
}

Measured memory_bytes: 27248
import java.util.*;

class Main{
	
    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	int N = sc.nextInt();

	int ans =0;

	int V[] =new int[N];

	int C[] =new int[N];

	for(int i =0; i<N ;i++){	

	V[i] = 	sc.nextInt();			

   }

	for(int i =0; i<N ;i++){

	C[i] = sc.nextInt();

   }

	for(int i =0; i<N ;i++){

	if(C[i]<V[i]){

	ans += (V[i]-C[i]);	

    }
   }	

	System.out.println(ans);
  }
 }

Measured memory_bytes: 21972
#include<iostream>

using namespace std;

int r,c;
short stat[10000];

int cnt0(short a)
{
	int cnt=0;
	for(int i=0;i<r;i++)	if(~a&(1<<i))	cnt++;
	return cnt;
}

int main()
{
	for(;cin>>r>>c,r;){
		for(int j=0;j<c;j++)	stat[j]=0;
		for(int i=0;i<r;i++){
			for(int j=0;j<c;j++){
				int t;	cin>>t;
				stat[j]|=t<<i;
			}
		}

		int zmax=0;
		for(int i=0;i<(1<<r);i++){
			int zero=0;
			for(int j=0;j<c;j++){
				zero+=max(cnt0(stat[j]^i),cnt0(~(stat[j]^i)));
			}
			zmax=max(zmax,zero);
		}

		cout<<zmax<<endl;
	}

	return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> Foods(M, 0);
  int K, A;
  for(int i=0; i<N; i++){
    cin >> K;
    for(int j=0; j<K; j++){
      cin >> A;
      Foods[--A]++;
    }
  }
  int ans=0;
  for(int i=0; i<M; i++){
    if(Foods[i] == N){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int X,A,B;
  cin >> X >> A >> B;
  if(A>=B){
  cout << "delicious" << endl;
  }
  else if(X>=B-A){
  cout << "safe" << endl;
  }
  else if(B-A>=X+1){
  cout << "dangerous" << endl;
  }
}


  



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

#define MAX_H 50
#define MAX_W 50

char target[MAX_H+1][MAX_W+1];
int H, W;

int main() {
    // input
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> target[i][j];
        }
    }
    // process
    bool flag = true;
    int dxs[4] = {-1, 1, 0, 0};
    int dys[4] = {0, 0, -1, 1};
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (target[i][j] == '#') {
                bool k_flag = false;
                for (int k = 0; k < 4; k++) {
                    int ny = i + dys[k], nx = j + dxs[k];
                    if (0 <= ny && ny < H && 0 <= nx && nx < W && target[ny][nx] == '#') {
                        k_flag = true;
                    }
                }
                if (!k_flag) flag = false;
            }
            if (!flag) break;
        }
        if (!flag) break;
    }
    // output
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

string S;
int len, ans;

void dfs(int s, int e, int sum) { //s:最後に+が入っている箇所（0~len-1） e:現在+を入れるかどうか決定する箇所（1~len）sum:sより手前の部分の和
    if (e==len) {
        ans += (sum + atoll(S.substr(s, e-s).c_str()));
    } else {
        /* +を入れない場合 */
        dfs(s, e+1, sum);
        /* +を入れる場合 */
        dfs(e, e+1, sum+atoll(S.substr(s, e-s).c_str()));
    }
}

signed main() {
    cin >> S;
    len = (ll)(S.size());
    ans = 0;
    dfs(0, 1, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-
x = int(input())

if x < 600:
    print(8)
elif x < 800:
    print(7)
elif x < 1000:
    print(6)
elif x < 1200:
    print(5)
elif x < 1400:
    print(4)
elif x < 1600:
    print(3)
elif x < 1800:
    print(2)
elif x < 2000:
    print(1)
    
        



Measured memory_bytes: 9196
n, x = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]

count = 0
for i in range(0, n):
    if i == 0:
        counti = max(0, a[i] - x)
        a[i] -= counti
        count += counti
    else:
        counti = max(0, a[i] + a[i-1] - x)
        a[i] -= counti
        count += counti

print(count)

Measured memory_bytes: 14056
#include <bits/stdc++.h>
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 << endl; 
  else cout << a << " " << b-1 << endl; 
  
}

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

using namespace std;

short d[5002][5002];
int n, m, a, b ,c;

main(){
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> a >> b >> c;
    d[a][b] = c + 1;
  }
  int ans = 0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      d[i][j] = max(d[i][j], (short)(max(d[i-1][j-1], d[i-1][j]) - 1));
      if(d[i][j]) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 50012
#include<iostream>
#include<string>
#include<vector>
int main() {
	std::string s;
	std::cin >> s;//1222
	long long x = 0;
	for (int bit = 0; bit < (1 << ((int)s.size() - 1)); bit++) {//0
		long long num=s[0]-'0';//1
		for (int i = 0; i < (int)s.size() - 1; i++) {//0
			if (bit&(1 << i)) {
				num += s[i+1] - '0';
			}
			else {
				num -= s[i+1] - '0';
			}
		}
		if (num == 7) {
			x = bit;
			break;
		}
	}
	for (int i = 0; i < (int)s.size() - 1; i++) {
		std::cout << s[i] << (x&(1 << i) ? '+': '-');
	}
	std::cout << s[s.size() - 1] <<'='<<7<< std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;


int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++)cin>>h[i];
    int ans=1;
    for(int i=1;i<n;i++){
        bool flag=true;
        for(int j=0;j<i;j++){
            if(h[j]>h[i]){
                flag=false;
                break;
            }
        }
        if(flag)ans++;
    }
    cout<<ans<<endl;
    
    
    
}


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

int H, W, K, A[309][309], num;
int cnt[309];
char c[309][309];

void solve(int cl, int cr) {
	vector<int> P;
	for (int i = cl; i <= cr; i++) {
		for (int j = 1; j <= W; j++) {
            //イチゴがあるとその位置をPに追加
			if (c[i][j] == '#') P.push_back(j);
		}
	}

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

	for (int i = 0; i < P.size(); i++) {
		int v1 = 1, v2 = W;
        //前のイチゴ+1が左端
		if (i >= 1) v1 = P[i - 1] + 1;
        //今のイチゴP[i]が右端
		if (i < (int)P.size() - 1) v2 = P[i];
		num++;
		for (int j = cl; j <= cr; j++) {
			for (int k = v1; k <= v2; k++) A[j][k] = num;
		}
	}
}

int main() {
	cin >> H >> W >> K;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> c[i][j];
            //各行にあるイチゴの数を記録
			if (c[i][j] == '#') cnt[i]++;
		}
	}

	vector<int> vec;
    //イチゴがある行はvecにpbする
	for (int i = 1; i <= H; i++) { if (cnt[i] >= 1) vec.push_back(i); }
	for (int i = 0; i < vec.size(); i++) {
         //上下の範囲を指定してsolve()を呼び出す
		int v1 = 1, v2 = H;
        //前イチゴがあった行+1行めが次の範囲の上限
		if (i >= 1) v1 = vec[i - 1] + 1;

        //今イチゴがある行が範囲の加減
		if (i < (int)vec.size() - 1) v2 = vec[i];

		solve(v1, v2);
	}
    

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (j >= 2) cout << " "; cout << A[i][j];
		}
		cout << endl;
	}
	return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  int ans = k * pow(k-1, n-1);
  cout << ans << endl;
  return 0;
}

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

using ll=long long;
const ll MOD=998244353;
ll dp[4001][4001],a,b,c,d;
ll f(ll A,ll B){
  if(A<a||B<b)return 0;
  if(~dp[A][B])return dp[A][B];
  return dp[A][B]=(MOD+f(A-1,B)*B+f(A,B-1)*A-f(A-1,B-1)*(A-1)*(B-1)%MOD)%MOD;
}

int main(){
  cin>>a>>b>>c>>d;
  memset(dp,-1,sizeof(dp));
  dp[a][b]=1;
  cout<<f(c,d)<<endl;
}


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

using namespace std;
typedef long long ll;

int main() {
	int count = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s.at(i) == 'o')count++;
	}
	cout << (700 + count * 100) << endl;
	return 0; 
}

Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var s = nextCharArray();
  var output = 0;
  var check = false;
  var check2 = false;
  while(s.length > 0){
    var z = new Array(s.length).fill(0);
    for(var i = 1, j = 0; i < s.length; i++){
      if(i + z[i - j] < j + z[j]){
        z[i] = z[i - j];
      }else{
        var k = Math.max(0, j + z[j] - i);
        while(i + k < s.length && s[k] == s[i + k]){
          k++;
        }
        z[i] = k;
        j = i;
      }
    }
    z[0] = s.length;
    for(var j = 0; j < s.length - 1; j++){
      output = Math.max(output, Math.min(j, z[j]));
    }

    s.shift();
  }
  
  myout(output);
}


Measured memory_bytes: 36632
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin>>s;
    if(s.length()==1){
        cout<<s;
    }else{
        bool f=true;
        for(int i=1;i<s.length();i++){
            if(s[i]!='9'){
                f=false;
                break;
            }
        }
        if(f){
            cout<<s[0]-48+9*(s.length()-1);
        }else{
           cout<<s[0]-49+9*(s.length()-1); 
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

ll c2(ll n){
    return n*(n-1)/2;
}

int main(void)
{
    ll n, total=0;
    cin >> n;
    vector<ll> a(n), cnt(n);
    rep(i,n){
        cin >> a[i];
        a[i]--;
        cnt[a[i]]++;
    }
    rep(i,n) total += c2(cnt[i]);
    rep(i,n){
        ll ans = total;
        ans -= c2(cnt[a[i]]);
        ans += c2(cnt[a[i]]-1);
        cout << ans << endl;
    }
    return 0;
}

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

int main(){
  int n, k;
  vector<int> height;
  
  cin >> n >> k;
  
  for(int i=0; i<n; i++){
    int h;
    cin >> h;
    height.push_back(h);
  }
  
  sort(height.begin(), height.end());
  
  int ans = height[n-1];
  for(int i=0; i<n-k+1; i++){
    ans = min(ans, height[k-1+i] - height[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

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

int main(void){
	int n;
	scanf("%d",&n);
	int d[lim];
	for(int i=0;i<n;i++)scanf("%d",&d[i]);
	qsort(d,n,sizeof(int),cmp);
	int ans=0;
	int left=0;
	int K;
	int c=0;
	bool ok=false;
	for(K=1;K<=100000;K++){
		if(K>d[n-1])break;
		while(K>d[c]){
			left++;
			c++;
		}
		if(left==n/2){
			ok=true;
			break;
		}
	}
	
	if(ok)ans=d[c]-K+1;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 892
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	int a, b, c;
	cin >> a >> b >> c;
	cout << (c >= a && c <= b ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
  /*  #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
  ll n,k;
  cin>>n>>k;
  ll a[n+1],dp[n+1];
  for(int i=1;i<=n;i++)
    {
      cin>>a[i];
      dp[i]=INT_MAX;
    } 
    dp[1]=0;
    dp[0]=0;
    for(int i=2;i<=n;i++)
    {
        for(int j=i-1;j>=i-k;j--)
        {
               if(j>=1)
                 dp[i]=min(dp[i],abs(a[i]-a[j])+dp[j]);
        }
    } 
    cout<<dp[n]<<endl;
}
return 0;
}

Measured memory_bytes: 1920
import sys
from collections import defaultdict
a = input()
alst = [0, 1]
blst = [0, 1]
clst = [0, 1]
ans = ''
for i in alst:
    for j in blst:
        for k in clst:
            tmp = 0
            ans = ''
            if i == 0:
                tmp = int(a[0]) + int(a[1])
                ans = a[0] + '+' + a[1]
            else:
                tmp = int(a[0]) - int(a[1])
                ans = a[0] + '-' + a[1]
            if j == 0:
                tmp = tmp + int(a[2])
                ans = ans + '+' + a[2]
            else:
                tmp = tmp - int(a[2])
                ans = ans + '-' + a[2]
            if k == 0:
                tmp = tmp + int(a[3])
                ans = ans + '+' + a[3]
            else:
                tmp = tmp - int(a[3])
                ans = ans + '-' + a[3]
            if tmp == 7:
                print(ans + '=7')
                sys.exit()

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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

            //入力読取。
            List<int> combList = new List<int>();
            string strBreak = "0 0";
            while (true)
            {
                string strMaxAndSum = Console.ReadLine();
                if (strMaxAndSum == strBreak)
                {
                    break;
                }
                Calculation insC = new Calculation(strMaxAndSum);
                combList.Add(insC.GetComb());
            }

            //出力
            foreach (int comb in combList)
            {
                Console.WriteLine(comb);
            }

            Console.ReadKey();
        }
    }

    class Calculation
    {
        private string strMaxAndSum;
        private int intComb;

        public Calculation(string strMaxAndSum)
        {
            this.strMaxAndSum = strMaxAndSum;
            CombCount();
        }

        private void CombCount()
        {
            string[] strMaxSumArr = strMaxAndSum.Split(' ');
            int intMax = int.Parse(strMaxSumArr[0]);
            int intWantSum = int.Parse(strMaxSumArr[1]);
            for (int firstNum = 1; firstNum < intMax - 1; firstNum++)
            {
                for (int secondNum = firstNum + 1; secondNum < intMax; secondNum++)
                {
                    for (int thirdNum = secondNum + 1; thirdNum <= intMax; thirdNum++)
                    {
                        int intSum = firstNum + secondNum + thirdNum;
                        if (intWantSum == intSum)
                        {
                            intComb++;
                        }
                        intSum = 0;
                    }
                }
            }
        }

        public int GetComb()
        {
            return intComb;
        }

    }


}



Measured memory_bytes: 15908
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  auto s=readln.chomp.to!(char[]);
  int x, y; rd(x, y);

  auto n=s.length;

  int[] dxs, dys;
  for(int i=0, t=1; i<n; i++, t^=1){
    int d=0;
    while(i<n && s[i]=='F') i++, d++;
    if(d==0) continue;
    if(t&1) dxs~=d;
    else dys~=d;
  }

  // wr(dxs); wr(dys);

  auto xlen=dxs.length, ylen=dys.length;
  auto xrec=new bool[][](xlen+1, 8000*3);
  auto yrec=new bool[][](ylen+1, 8000*3);
  auto ofse=8000*3/2;
  xrec[0][ofse]=yrec[0][ofse]=true;
  foreach(i; 0..xlen)for(auto j=0; j<=22000; j++){
    if(xrec[i][j]){
      xrec[i+1][j+dxs[i]]=true;
      if((i>0) || (s[0]=='T')) xrec[i+1][j-dxs[i]]=true;
    }
  }
  foreach(i; 0..ylen)for(auto j=0; j<=22000; j++){
    if(yrec[i][j]){
      yrec[i+1][j+dys[i]]=true;
      yrec[i+1][j-dys[i]]=true;
    }
  }

  if(xrec[xlen][x+ofse] && yrec[ylen][y+ofse]) writeln("Yes");
  else writeln("No");
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) stderr.write(e, " ");
  stderr.writeln();
}

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

#define LL long long
#define hell 1000000007
#define PI acos(-1.0)



int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << showpoint;
cout << setprecision(11);

LL ar[5];for(int i=0;i<5;i++) cin>>ar[i];

cout<<(min_element(ar, ar+5)-ar)+1;

return 0;
} 

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

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

      int A = in.nextInt();
      int B = in.nextInt();
      int C = in.nextInt();

      if(A == B) {
          System.out.println(C);
      }
      else if(C == B) {
          System.out.println(A);
      }
      else {
          System.out.println(B);
      }


    }
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int N, A, B, ans;
    cin >> N >> A >> B;
    if(A + B <= N) { ans = 0; }
    else { ans = A + B - N; }
    printf("%lld %lld\n", min(A, B), ans);
    return 0;
}


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

typedef long long ll;

void swap(ll*, ll*);
ll gcd(ll, ll);
ll lcm(ll, ll);
int main(){
  int n; cin >> n;
  ll t[n];
  for(int i=0; i<n; i++) cin >> t[i];

  ll ans = t[0];
  for(int i=0; i<n; i++){
    if(ans%t[i]!=0){
      ans = lcm(ans, t[i]);
    }
  }

  cout << ans << endl;

  return 0;
}

void swap(ll* a, ll* b){
  ll temp = *a;
  *a = *b;
  *b = temp;
}

ll gcd(ll a, ll b){
  if(a<b) swap(a, b);
  ll r = 1;//適当な数
  while(r!=0){
    r = a%b;
    a = b;
    b = r;
  }
  return a;
}

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


Measured memory_bytes: 256
def a():
    i = input().split(' ')
    N = int(i[0])
    T = int(i[1])
    c = []
    t = []
    for _ in range(N):
        i = input().split(' ')
        c.append(int(i[0]))
        t.append(int(i[1]))
    sat_c = []
    for cc, tt in zip(c, t):
        if tt <= T:
            sat_c.append(cc)
    if sat_c == []:
        print('TLE')
    else:
        print(min(sat_c))
        
a()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
bool m[305][305];
int t[305];
int main(){
    int h, w, k;
    cin>> h>> w>>k;
    string s;
    for(int i=0; i<h; ++i){
        cin>> s;
        for(int j=0; j<w; ++j){
            if(s[j]=='#') m[i][j]=true;
            else m[i][j]=false;
        }
    }
    int l=1;
    int br=0;
    int i=0;
    while(br==0){
        for(int j=0; j<w; ++j) if(m[i][j]) br++;
        i++;
    }
    i--;
    int ii=i;
    for(i; i<h; ++i){
        bool f=true, b=false;
        for(int j=0; j<w; ++j)
                if(m[i][j]) b=true;

        if(!b){
            for(int j=0; j<w; ++j) cout<< t[j]<< " ";
            continue;
        }
        for(int j=0; j<w; ++j){
            if(m[i][j]) b=true;
            if(m[i][j] && f) {
                    cout<< l<< " ";
                    t[j]=l;
                    f=false;
            }
            else if(f){
                    cout<< l << " ";
                    t[j]=l;
            }
            else if(m[i][j]){
                l++;
                cout<< l<< " ";
                t[j]=l;
            }
            else {
                    cout<< l<< " ";
                    t[j]=l;
            }
        }
        cout<<endl;
        l++;
        if(i==ii){
            while(ii--){
                for(int j=0; j<w; ++j) cout<< t[j]<<" ";
                cout<<endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    if (n==3){
        cout<<"2 5 63";
        return 0;
    }
    int num3=max(n-30000/2,2);
    n-=num3;
    if (n>30000/2)num3+=n-15000,n=15000;
    int l=2;
    if (num3&1){
        num3++;
        n--;
    }
    if ((l+l+(long long)(n-1)*2)*n/2%3){
        n-=2;
        num3+=2;
    }
    for (int i=l;n;i+=2)
        cout<<i<<' ',n--;
    for (int i=3;num3;i+=6)
        cout<<i<<' ',num3--;
    return 0;
}

Measured memory_bytes: 384
def main():
    n = int(input())
    s = list(map(int,input().strip().split()))
    e = []
    for ss in s:
        if ss % 2 == 0:
            e.append(ss)
    
    for ee in e:
        if ee % 3 == 0 or ee % 5 == 0:
            continue
        else:
            print("DENIED")
            return
    
    print("APPROVED")
    return

main()


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

std::vector<int> getGapArray(int n) {
    std::vector<int> gaps;
    gaps.push_back(1);
    for (int h = 4; h < n; h = 3 * h + 1) {
        gaps.push_back(h);
    }
    std::reverse(gaps.begin(), gaps.end());
    return gaps;
}

int insertionSort(std::vector<int>& A, int g) {
    int cnt = 0;
    int v, j;
    for (int i = g; i < A.size(); i++) {
        v = A[i];
        j = i - g;
        while (j >= 0 && A[j] > v) {
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
    return cnt;
}

int shellSort(std::vector<int>& A, std::vector<int>& G) {
    int cnt = 0;
    for (int i = 0; i < G.size(); i++) {
        cnt += insertionSort(A, G[i]);
    }
    return cnt;
}

int main(int argc, const char *argv[]) {
    int n;
    std::cin >> n;
    std::vector<int> A(n);
    for (int i = 0; i < n; i++) {
        std::cin >> A[i];
    }
    
    std::vector<int> G = getGapArray(n);
    int cnt = shellSort(A, G);
    
    std::cout << G.size() << std::endl;
    std::cout << G[0];
    for (int i = 1; i < G.size(); i++) {
        std::cout << " " << G[i];
    }
    std::cout << std::endl;
    std::cout << cnt << std::endl;
    for (int i = 0; i < A.size(); i++) {
        std::cout << A[i] << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 6700
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int x;
int main()
{
	cin>>x;
	for (int i=1;i<=10000;++i)
	{
		if ((x*i)%360==0)
		{
			cout<<i<<"\n";
			return 0;
		}
	}
    return 0;
}

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

int main() {
	int a,b;
    cin >> a >> b;
    
    int ans = 0;
   	for(int i = a; i <= b; i++) {
    	int temp = i;
    	int palind = 0;
    	while(temp > 0) {
        	int n = temp % 10;
            temp /= 10;
            palind *= 10;
            palind += n;
       }
       if(i == palind) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 200005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	char c;
	cin>>c;
	if(c>='a'){
		cout<<'a';
	}
	else cout<<'A';

	return 0;	
}

Measured memory_bytes: 3612
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int calcCost(int src, int dst)
{
	return abs(src - dst);
}

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

	vector<int> A(N+2, 0);
	for(int i=1; i<=N; i++)
		cin >> A[i];

	int sum = 0;
	for(int i=0; i<A.size()-1; i++)
		sum += calcCost(A[i], A[i+1]);

	for(int i=1; i<=N; i++){
		cout << sum - calcCost(A[i-1], A[i]) - calcCost(A[i], A[i+1]) + calcCost(A[i-1], A[i+1]) << endl;
	}

	return 0;
}


Measured memory_bytes: 1664