akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define Test int T;cin>>T;while(T--)
#define ls lower_bound
#define up upper_bound
#define bs binary_search
#define S second
#define F first
#define vi vector<int>  
#define pii pair<int,int>
#define vpi vector<pii>
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define m_n(v) *min_element(all(v))
#define m_x(v) *max_element(all(v))
/* 
#include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
*/
int power(int x, int y,int mod){
    int res = 1;
    while (y)
    {
        if (y & 1)
        res = (res*x)%mod;
        y = y>>1;
        x = (x*x)%mod;
    }
    return res;
}
int modInverse(int a, int m){
    int m0 = m;
    int y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
int binomial(int n,int k){
    int res = 1;
    if ( k > n - k )
        k = n - k;

    for (int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
/*vector<int> prime;
void sieve(){
    bool arr[300000]={0};
    prime.pb(2);
    for(int i=3;i<300000;i+=2){
        if(arr[i])continue;
        for(int j=i*i;j<300000;j+=i) arr[j]=1;
        prime.pb(i);
    }
}*/
const int mod=1e9+7;
int32_t main() {
    IOS;
    int x,y;
    cin>>x>>y;
    if(y>=2*x and y<=4*x and y%2==0) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  long long arr[n];
  int sz=n;
  while(--n>-1){
    cin>>arr[n];
  }
  
  sort(arr,arr+sz);
  
  long long ans =0;
  int i=0;
  k=sz-k;
  while(i<k){
    ans+=arr[i++];
  }
  cout<<ans<<"\n";
  return 0;
}
  


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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
// int ab  (int  x ) { return (x>0?x:-x); }

int main(){
	int a , b , c ; 
	cin >> a >> b >> c ; 
	cout << max((c-(a-b)),0) << endl; 
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a, b, c, d, e;
  scanf("%d", &a);
  if(a == 0) printf("1");
  scanf("%d", &b);
  if(b == 0) printf("2");
  scanf("%d", &c);
  if(c == 0) printf("3");
  scanf("%d", &d);
  if(d == 0) printf("4");
  scanf("%d", &e);
  if(e == 0) printf("5");
  return 0;
}

Measured memory_bytes: 1640
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i = 0; i < (int)(n); i++)

int main() {
  int N; cin>>N;
  int K; cin>>K;
  const ll LK = (ll)K;
  vector<ll> A(N), S(N+1,0);
  REP(i,N) {
    cin>>A[i];
    S[i+1] = S[i] + A[i];
  }
  map<ll, int> cnt;
  ll ans = 0;
  cnt[S[0]]++;
  for(int i = 1; i <= N; i++) {
    int j = i - K;
    if(j >= 0) cnt[(S[j]-(ll)j + LK) % LK]--;
    ll tmp = cnt[(S[i]-(ll)i + LK) % LK] ++;
    ans += tmp;
    //    cout << (S[i] - (ll)i + LK)% LK << " " << ans << " " << tmp << endl;
  }

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


Measured memory_bytes: 15872
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int MOD=1000000007;
signed main(){
    char s;cin>>s;
    char res;
    if(s=='A')res='T';
    if(s=='T')res='A';
    if(s=='C')res='G';
    if(s=='G')res='C';
    cout<<res<<endl;
    return 0;
}

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

using namespace std;

void solve()
{
	string A, B;
	cin >> A >> B;
	if (A.size() > B.size())
	{
		cout << "GREATER" << endl;
	}
	else if (A.size() < B.size())
	{
		cout << "LESS" << endl;
	}
	else
	{
		for (int i = 0; i < A.size(); ++i)
		{
			if (A[i] > B[i])
			{
				cout << "GREATER" << endl;
				return;
			}
			else if (A[i] < B[i])
			{
				cout << "LESS" << endl;
				return;
			}
		}
		cout << "EQUAL" << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

#define ll long long

int main()
{
    ll n,m;
    map<ll,string> mp;

    cin>>n>>m;

    if(m==0)
    {
        cout<<"0 0"<<endl;
        return 0;
    }
    ll cnt=0;
    vector<ll> t(n+1,0);
    for(ll i=1;i<=m;i++)
    {
        ll x;
        string y;
        cin>>x>>y;
        if(mp.count(x)>0){
            if(mp[x]=="WA")
            {
                if(y=="AC")
                {
                    mp[x]=y;
                    cnt++;
                    
                }
                else{
                    t[x]++;
                }
            }
        }
        else{
            mp[x]=y;
            if(y=="AC")
            {
                cnt++;
            }else
            {
                t[x]++;
            }
            
        }
    }
    ll sum=0;
   
    for(int i=1;i<t.size();i++)
    {
        if(mp[i]=="AC")
        {
            sum+=t[i];
        }
    }

    cout<<cnt<<" "<<sum<<endl;
}

Measured memory_bytes: 11904
n = int(input())
a = [int(input()) for i in range(n)]

def lis_linear(a, n):
    dp = [0 for i in range(n)]
    longest = 1
    for i in range(n):
        max_val = 1
        for j in range(i):
            if a[j] < a[i] and max_val < dp[j] + 1:
                max_val = dp[j] + 1
        dp[i] = max_val
        if dp[i] > longest: longest = dp[i]
    return longest

def lis_binary(a, n):
    tail = [a[0]]
    for i in range(1, n):
        if a[i] > tail[-1]:
            tail.append(a[i])
            continue
        for j in range(len(tail)):
            if a[i] <= tail[j]:
                tail[j] = a[i]
                break
    return len(tail)

print(lis_binary(a, n))


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

int main() {

  int a, b;
  cin >> a >> b;
  
  if ( (a + b) / 2 * 2 < a + b) {
    cout << (a + b) / 2 + 1 <<endl;
  }
  else { 
    cout << (a + b) / 2 <<endl;
  }
  
}


Measured memory_bytes: 3572
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
using namespace std;
using ll = long long int;
constexpr int MAX = 100005;

int n;
vector<vector<int>> to(MAX * 2);
vector<bool> visited(MAX * 2, false);
vector<ll> cnt(2, 0);
ll ret = 0;

void dfs(int v) {
	if (visited[v])
		return;
	visited[v] = true;
	cnt[v / MAX]++;
	for (int i = 0; i < to[v].size(); i++)
		dfs(to[v][i]);
	return;
}

int main(void) {
	cin >> n;
	for (size_t i = 0; i < n; i++) {
		int ai, bi;
		cin >> ai >> bi;
		bi += MAX;
		to[ai].push_back(bi);
		to[bi].push_back(ai);
	}
	ll ret = 0;
	for (int i = 0; i < MAX*2; i++) {
		if (visited[i])
			continue;
		cnt = vector<ll>(2, 0);
		dfs(i);
		ret += ll(cnt[0] * cnt[1]);
	}
	ret -= n;
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 9984
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
using namespace std;

int main(){
    int N;
    cin >> N;
    int A[200000];
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    int maxnum = 0;
    int secondnum = 0;
    int maxkey;
    int secondkey;
    for(int i = 0; i < N; i++){
        if(maxnum < A[i]){
            maxnum = A[i];
            maxkey = i;
        }
        else if(secondnum < A[i] && A[i] <= maxnum){
            secondnum = A[i];
            secondkey = i;
        }
    }
    for(int i = 0; i < N; i++){
        if(i == maxkey){
            cout << secondnum << endl;
        }
        else{
            cout << maxnum << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4424
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void)
{
  int n;
  scanf("%d", &n);

  int ans = (n - 1) / 2;
  printf("%d\n", ans);
  return 0;
}


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

using namespace std;

int main(){
  string S;
  int w=0;
  getline(cin,S);
  cin >> w;
  for(int i = 0; i < S.length() ; i ++){
    if(i%w == 0){
      cout << S[i] ;
    }
  }

}


Measured memory_bytes: 256
program answer
  implicit none
  integer(16) :: i, x, k, d, count
  read(*,*) X, K, D

  if(x==0) then
     if(mod(k,2)==0) then
        write(*,*) '0'
        stop
     else
        write(*,*) D
        stop
     end if
  end if

  if(x<0) then
     if(x+k*d>=0) then
        count=0
        do
           if(x>=0) then
              exit
           end if
           x=x+d
           count=count+1
        end do
        if(mod(count,2)==0) then
           if(mod(k,2)==0) then
              write(*,*) abs(x)
              stop
           else
              write(*,*) abs(x-d)
              stop
           end if
        else
           if(mod(k,2)==0) then
              write(*,*) abs(x-d)
              stop
           else
              write(*,*) abs(x)
              stop
           end if
        end if
      else
           write(*,*) abs(x+k*d)
           stop
     end if
  else
     if(x-k*d<=0) then
        count=0
        do
           if(x<=0) then
              exit
           end if
           x=x-d
           count=count+1
        end do
        if(mod(count,2)==0) then
           if(mod(k,2)==0) then
              write(*,*) abs(x)
              stop
           else
              write(*,*) abs(x+d)
              stop
           end if
        else
           if(mod(k,2)==0) then  
              write(*,*) abs(x+d)
              stop
           else
              write(*,*) abs(x)
              stop
           end if
        end if
     else
        write(*,*) abs(x-k*d)
        stop
     end if
  end if

  stop
 end program answer

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

using namespace std;
#define  F first
#define  S second
#define  pii pair<int,int>
const int MAX = 1e6+6;

int n , a[MAX] , sol;

int main() {
    cin>>n;
    for(int i = 0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i = 1;i<n-1;i++)
    {
        if(a[i]<a[i-1] && a[i]>a[i+1])
            sol++;
        if(a[i]<a[i+1] && a[i]>a[i-1])
            sol++;
    }
    cout<<sol;

}



Measured memory_bytes: 764
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private int N, W;
    private int[] w, v;

    private const int nu = -1;

    private void Scan()
    {
        var line = Console.ReadLine().Split(' ');
        N = int.Parse(line[0]);
        W = int.Parse(line[1]);
        w = new int[N];
        v = new int[N];
        for (int i = 0; i < N; i++)
        {
            line = Console.ReadLine().Split(' ');
            w[i] = int.Parse(line[0]);
            v[i] = int.Parse(line[1]);
        }
    }

    public void Solve()
    {
        Scan();
        long[,,] dp = new long[N + 1, N + 1, 301];
        for (int i = 0; i <= N; i++)
        {
            for (int j = 0; j <= N; j++)
            {
                for (int k = 0; k <= 300; k++)
                {
                    dp[i, j, k] = nu;
                }
            }
        }

        dp[0, 0, 0] = 0;

        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                for (int k = 0; k <= 300; k++)
                {
                    if (dp[i, j, k] == nu)
                    {
                        continue;
                    }

                    dp[i + 1, j, k] = Math.Max(dp[i + 1, j, k], dp[i, j, k]);
                    if (W < (long)j * w[0] + w[i] + k)
                    {
                        continue;
                    }
                    dp[i + 1, j + 1, k + w[i] - w[0]] = Math.Max(dp[i + 1, j + 1, k + w[i] - w[0]], dp[i, j, k] + v[i]);

                }
            }
        }
        long ans = -1;
        for (int i = 0; i <= N; i++)
        {
            for (int j = 0; j <= N; j++)
            {
                for (int k = 0; k <= 300; k++)
                {
                    ans = Math.Max(ans, dp[i, j, k]);
                }
            }
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 34912
import java.util.Scanner;

class Main{
    static public void main(String[] av){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int A[] = new int[n];
	for(int i=0; i<n; i++){
	    A[i] = sc.nextInt();
	}

	for(int i=0; i<n; i++){
	    int v = A[i];
	    int j = i-1;
	    while(j>=0 && A[j]>v){
		A[j+1] = A[j];
		j--;
	    }
	    A[j+1] = v;
	    System.out.print(A[0]);
	    for(int x=1; x<n; x++){
		System.out.print(" "+A[x]);
	    }
	    System.out.println();
	}
    }
}



Measured memory_bytes: 31956
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=200005;
//i_am_noob
int n,a[maxn],b[maxn];

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n;
    rep(n) cin >> a[i];
    rep(n) b[i]=a[i];
    sort(b,b+n);
    rep(n) print1(a[i]<=b[n/2-1]?b[n/2]:b[n/2-1]);
	return 0;
}


Measured memory_bytes: 5376
import java.util.Scanner;

class Main {

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

		for(int i=0; i<N; i++){
			A[i] = sc.nextInt();
		}

		int[] x = new int[N];
		x[0]=0;
		for(int i=0;i<N;i++){
			x[0] += i%2==0 ? A[i] : -1*A[i];
		}
		for(int i=0; i<N-1; i++){
			x[i+1] = 2*A[i] - x[i];
		}

		for(int i=0;i<N;i++){
			System.out.print(x[i] + " ");
		}
		System.out.println();



	}
}


Measured memory_bytes: 62580
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 4e5 + 5, mod = 1e9 + 7;

int a[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    set<ll> st;
    for(int i = 1; i < 10; i++){
        st.insert(i);
    }
    ll k, val;
    cin >> k;
    while(k--){
        auto it = st.begin();
        val = *st.begin();
        st.erase(st.begin());
        // cout << val << '\n';
        int mod = val % 10;
        st.insert(val * 10 + mod);
        if(mod) st.insert(val * 10 + mod - 1);
        if(val % 10 != 9) st.insert(val * 10 + mod + 1);
    }
    cout << val;

    return 0;
}


Measured memory_bytes: 9216
#include <iostream>
#include <fstream>
#include <queue>
#include <cassert>
using namespace std;

const int MAXN = 2e5+2;

struct D {
	int x;
	int pos;
	bool operator<(const D& o) const {
		return x < o.x;
	}
}a[MAXN], b[MAXN];

priority_queue<D> q;

int n;

int main() {
#ifdef DEBUG
	freopen("in", "r", stdin);
#endif 
	scanf("%d", &n);
	for (int i=0; i<n; ++i) {
		scanf("%d", &a[i].x);
		a[i].pos = i;
	}
	int cnt = 0;
	long long ans = 0;
	for (int i=0; i<n; ++i) {
		scanf("%d", &b[i].x);
		b[i].pos = i;
		if (a[i].x == b[i].x) ++cnt;
		else q.push(b[i]);
	}
	
	while (cnt != n && !q.empty()) {
		const D now = q.top();
		q.pop();
		if (now.x == a[now.pos].x) continue;
		const int sub = b[(now.pos-1+n)%n].x + b[(now.pos+1)%n].x;
		if (b[now.pos].x-sub < a[now.pos].x) break;
		int nex = q.empty() ? q.top().x : 0;
		nex = max(nex, a[now.pos].x);
		//printf("now=%d nex=%d\n", b[now.pos].x, nex);
		const int tim = max((b[now.pos].x-nex)/sub, 1);
		//assert(tim>0);
		b[now.pos].x -= sub * tim;
		ans += tim;
		if (b[now.pos].x > a[now.pos].x) q.push(b[now.pos]);
		else ++cnt;
	}

	if (cnt == n)
		printf("%lld\n", ans);
	else printf("-1\n");

	return 0;
}


Measured memory_bytes: 5108
nim = input()
mike = input()
for i in range(len(nim)-len(mike)+1)[::-1]:
    for j in range(len(mike))[::-1]:
        if nim[i+j] != mike[j] and nim[i+j] != "?":
            break
    else:
        nim = nim[:i] + mike + nim[i+len(mike):]
        print(nim.replace("?", "a"))
        exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

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

  cout << (N + N*N+N*N*N) << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 3160
#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::collections::{HashSet,HashMap};
#[allow(unused_imports)]
use std::collections::{BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::collections::BinaryHeap;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn gcd(mut a: i32, mut b: i32) -> i32 {
    while b != 0 {
        let r = a % b;
        a = b; b = r;
    }
    a
}
fn lcm(x: i32, y: i32)->i32{
    return x /gcd(x, y) * y;
}
fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
        n: usize,
        a: [i32; n],
    }
    let mut ans = a[0];
    for i in 1..n{
        ans = lcm(ans, a[i]);
    }
    puts!("{}\n", ans);

    
}


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

int main(){
    using namespace std;
    unsigned long Q;
    cin >> Q;
    constexpr auto M{205891132094649UL};
    const auto& calc = [](auto a, auto b, auto c, auto d){
        auto u{b}, p{M};
        while(p /= 3)if(a / p + (4 - a / p % 3) % 3 <= c / p && b / p % 3 == 1){
            u = b / (3 * p) * 3 * p + 2 * p;
            break;
        }
        return c - a + min(u - b + max(u, d) - min(u, d), b + d - 2 * (b / (3 * p) * 3 * p + p - 1));
    };
    for(unsigned long _{0}, a, b, c, d; _ < Q; ++_){
        cin >> a >> b >> c >> d;
        if(--a > --c)swap(a, c), swap(b, d);
        if(--b > --d){
            b = M - b - 1;
            d = M - d - 1;
        }
        cout << max(calc(a, b, c, d), calc(b, a, d, c)) << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n; cin >> n;
    vector<int> ans(n + 1, 0);

    FOR(i, 2, n + 1) {
        int a; cin >> a;
        ans[a]++;
    }

    FOR(i, 1, n + 1) cout << ans[i] << endl;
}


Measured memory_bytes: 3560
//0030
//template
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

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

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

int dfs(int n,int s,int now){
	int ans=0;
	if(now>10) return 0;
	if(n==0) return s==0?1:0;
	ans+=dfs(n-1,s-now,now+1);
	ans+=dfs(n,s,now+1);
	return ans;
}

int main(){

	int n,s;
	while(cin>>n>>s){
		if(n==0 && s==0) break;
		COUT(dfs(n,s,0))
	}

	return 0;

}

Measured memory_bytes: 1156
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int A=in(),B=in();

	cout << ((A*B)%2 ? "Yes" : "No") << endl;
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir[] = {"R", "D", "L", "U"};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll n, q, sum = 0;
    cin >> n >> q;
    REP(i,q){
        ll x, k;
        cin >> x >> k;
        if(x){
            sum += k;
            sum %= n;
        }
        else{
            cout << (sum+k-1)%n+1 << endl;
        }
    }
    return 0;
}



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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

struct edge{
  int to,cost,id;
  edge(){}
  edge(int to,int cost,int id):to(to),cost(cost),id(id){}
};

int n;
vector<edge> g[125252];
int weight[125252];
bool used[125252];
queue<int> Q;

int dist[125252];
int calc(int s, int ban){
  int a=s, mxd=0;
  REP(i,n)dist[i]=-1;
  dist[s] = 0;
  Q.push(s);
  while(!Q.empty()){
    int p = Q.front();Q.pop();
    REP(i,g[p].size()){
      edge e = g[p][i];
      if(e.id == ban)continue;
      int to = e.to;
      if(dist[to]>=0)continue;
      dist[to] = dist[p] + e.cost;
      if(dist[to] > mxd){
        mxd = dist[to];
        a = to;
      }
      Q.push(to);
    }
  }
  REP(i,n)dist[i]=-1;
  dist[a] = 0;
  int r = a;
  Q.push(a);
  while(!Q.empty()){
    int p = Q.front();Q.pop();
    REP(i,g[p].size()){
      edge e = g[p][i];
      if(e.id == ban)continue;
      int to = e.to;
      if(dist[to]>=0)continue;
      dist[to] = dist[p] + e.cost;
      if(dist[to]>dist[r])r=to;
      Q.push(to);
    }
  }
  return r;
}

int calc2(int end){
  REP(i,n-1)used[i]=false;
  int cur = end;
  while(dist[cur]>0){
    REP(i,g[cur].size()){
      edge e = g[cur][i];
      if(dist[e.to]<dist[cur]){
        cur = e.to;
        used[e.id] = true;
        break;
      }
    }
  }
  int ret = 0;
  REP(i,n-1)if(!used[i]) ret = max(ret,weight[i]);
  return ret;
}

int main(){
  scanf("%d",&n);
  int mxweight = 0;
  int src = 0,dst = 0,id = 0;
  REP(i,n-1){
    int to,w;
    scanf("%d%d",&to,&w);
    int from = i+1;
    g[from].push_back(edge(to,w,i));
    g[to].push_back(edge(from,w,i));
    if(w>mxweight){
      mxweight = w;
      src = from;
      dst = to;
      id = i;
    }
    weight[i] = w;
  }
  int ans = 0;
  // ??´???
  int end = calc(0,-1);
  int mxw = calc2(end);
  ans = max(ans,dist[end]+mxw);
  // ??¶??£?????????
  int cand = dist[calc(src,id)];
  cand = max(cand, dist[calc(dst,id)]);
  ans = max(ans,cand+mxweight);
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 10156
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int N=cin.nextInt();
		for(;N--!=0;){
			double x1=cin.nextDouble();
			double y1=cin.nextDouble();
			double x2=cin.nextDouble();
			double y2=cin.nextDouble();
			double x3=cin.nextDouble();
			double y3=cin.nextDouble();
			double p = ((y1-y3)*(y1*y1 -y2*y2 +x1*x1 -x2*x2) -(y1-y2)*(y1*y1 -y3*y3 +x1*x1 -x3*x3)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
			double q = ((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*x1 -x3*x3 +y1*y1 -y3*y3)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
			double dist = Math.sqrt(Math.pow(x1-p, 2)+Math.pow(y1-q, 2));
			BigDecimal ans1 = new BigDecimal(String.valueOf(p));
			BigDecimal ans2= new BigDecimal(String.valueOf(q));
			BigDecimal ans3 = new BigDecimal(String.valueOf(dist));
			p=ans1.setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue();
			q=ans2.setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue();
			dist=ans3.setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue();
			System.out.printf("%.3f ",p);
			System.out.printf("%.3f ",q);
			System.out.printf("%.3f\n",dist);
//			System.out.println(ans(p)+" "+ans(q)+" "+ans(dist));
		}
	}
	static String ans(double a){
		String s = String.valueOf(a);
		for(;s.length()!=5;){
			s=s+"0";
		}
		return s;
	}
}

Measured memory_bytes: 12000
#include <iostream>
using namespace std;
int main(void){
    char c1[5], c2[5];
    cin >> c1 >> c2;
    
    if(c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
N, M, X = gets.chomp.split.map(&:to_i)

arr = []
N.times {arr.push(gets.chomp.split.map(&:to_i))}

minimumCost = 10000000

N.times do |i|
    arr.combination(i + 1) do |c|
        # p c
        cRan = true
        cost = 0
        cSize = c.size
        M.times do |j|
            xsum = 0
            cost = 0
            cSize.times do |k|
                xsum += c[k][j + 1]
                cost += c[k][0]
            end

            if xsum < X then
                cRan = false
                break
            end
        end
        minimumCost = cost if cRan && cost < minimumCost
    end
end

unless minimumCost == 10000000 then
    puts minimumCost
else
    puts '-1'
end

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

using namespace std;


int main(){
    int x;cin>>x;
    int id;
    for(int i=1;;++i){
        if(i*360%x==0){
            id=i;
            break;
        }
    }
    cout<<id*360/x;

    return 0;
}


Measured memory_bytes: 3504
#include<iostream>
#include<cstdlib>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i(0);i<n;i++)
typedef long long ll;

int main(){
	int A[3][3];
    int C[3][3];
    rep(i,3){
        rep(j,3){
            cin >> A[i][j];
            C[i][j] = 0;
        }
    }

    int N;
    cin >> N;

    rep(i,N){
        int b;
        cin >> b;
        rep(i,3){
            rep(j,3){
            if(A[i][j]==b)
                C[i][j] = 1;
            }
        }
    }
    /*
    cout << endl;
    rep(i,3){
        rep(j,3){
            cout << C[i][j];
        }
        cout << endl;
    }*/

    string ans = "No";
    // 8 パターン

    rep(i,3){
        if(C[i][0] + C[i][1] + C[i][2] == 3) ans = "Yes";
        if(C[0][i] + C[1][i] + C[2][i] == 3) ans = "Yes";
    }

    if(C[0][0] + C[1][1] + C[2][2] == 3) ans = "Yes";
    if(C[0][2] + C[1][1] + C[2][0] == 3) ans = "Yes";

    //cout << C[0][0] + C[1][1] + C[2][2] << endl;

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


Measured memory_bytes: 256
import math
D,N = [int(i) for i in input().split()]
if (N != 100) :
    print(int(math.pow(100,D) * N))
else :
    # N = 100のときは割り切れてしまう(Dの条件に反してしまう)ので+1したものをかける
    print(int(math.pow(100,D) * 101))

Measured memory_bytes: 3060
//config = {input: 'tmp', newline: '\r\n'}; // win
config = {input: '/dev/stdin', newline: '\n'}; //linux

line = require('fs').readFileSync(config.input, 'ascii')
  .trim()
  .split(config.newline)
  .slice(1)
  .map(Number)
  .filter(function (x) {
    for (i = 2; i <= Math.floor(Math.sqrt(x)); i++)
      if (x % i === 0) return false;
    return true; })
  .length;
console.log(line);

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

int main()
{
  string s;
  cin >> s;
  int s1 = stoi(s.substr(0, 1));
  int s2 = stoi(s.substr(1, 1));
  int s3 = stoi(s.substr(2, 1));
  cout << s1 + s2 + s3 << endl;
}


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

using namespace std;

int gcd(int n, int m) {
    if (n == 0)
        return m;
    return gcd(m % n, n);
}

int bit_count(int i) {
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    i = (i + (i >> 4)) & 0x0f0f0f0f;
    i = i + (i >> 8);
    i = i + (i >> 16);
    return i & 0x3f;
}

int main() {
    char c;
    cin >> c;
    if (c == 'A') {
        cout << 'T' << endl;
        return 0;
    }
    if (c == 'T') {
        cout << 'A' << endl;
        return 0;
    }
    if (c == 'C') {
        cout << 'G' << endl;
        return 0;
    }
    if (c == 'G') {
        cout << 'C' << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 1000000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/

int dp[5100][5100];

int main(){
    int N;
    string S;
    cin>>N>>S;
    for(int j=N-1;j>=1;j--){
        for(int i=j-1;i>=0;i--){
            if(j==N-1){
                if(S[i]==S[j]) dp[i][j]=1;
                else dp[i][j]=0;
            }else{
                if(S[i]==S[j]) dp[i][j]=dp[i+1][j+1]+1;
                else dp[i][j]=0;
                if(dp[i][j]>j-i) dp[i][j]=j-i;
            }
        }
    }
    int ans=0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            ans=max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 100608
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
int main()
{
	string s;
	cin >> s;
	if (s == "ABC")
		cout << "ARC" << '\n';
	else
		cout << "ABC" << '\n';
	return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
bool fff(string a,string b)
{
	int c=a.length();
	for(int i=0;i<c;i++)
	{
		if(a[i]!=b[i])
			return a[i]<b[i];
	}
	return 0;
}
int main()
{
	int n,m;
	cin>>n>>m;
	string arr[101];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	sort(arr,arr+n,fff);
	for(int i=0;i<n;i++)
	{
		cout<<arr[i];
	}
	cout<<endl;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n;
    cin >> n;

    ll a[n];
    ll count = 0;
    rep(i, 0, n){
        cin >> a[i];
        if(a[i] % 2 == 1){
            count++;
        }
    }

    if(count % 2 == 0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int x, y, z, e, m;

    void run(){
	while(sc.hasNext()){
	    e = sc.nextInt();
	    if(e==0) break;
	    m = Integer.MAX_VALUE;
	    for(z=(int)Math.cbrt(e); z>=0; z--)
		for(y=(int)Math.sqrt(e); y>=0; y--){
		    x = e - y*y - z*z*z;
		    if(x<0) continue;
		    m = Math.min(x+y+z, m);
		}

	    System.out.println(m);
	}
    }
}

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

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

    int ans = 0;
    int o = 1;
    while(o < b){
        --o;
        o += a;
        ans ++;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3616
h, w, k = map(int, input().split())
s = [list(input()) for _ in range(h)]

ans = [[0] * w for _ in range(h)] 
start = 0
x = 1
cnt = 0

def sol(ans, s, x):
    cnt = 0
    start = 0
    for i in range(len(s)):
        if s[i].count("#") != 0:
            y = i
            break

    for i in range(w):
        if s[y][i] == "#":
            cnt += 1

        if i == w - 1 or (cnt == 1 and s[y][i + 1] == "#"):
            for a in range(len(s)):
                for b in range(start, i + 1):
                    ans[a][b] = x
            start = i + 1
            x += 1
            cnt = 0
    return x


for i in range(h):

    if s[i].count("#") >= 1:
        cnt += 1
    if  i == h - 1 or cnt == 1 and s[i + 1].count("#") >= 1:
        x = sol(ans[start: i + 1], s[start: i + 1], x)
        start = i + 1
        cnt = 0

for i in range(h):
    for j in range(w):
        print(ans[i][j], end = " ")
    print()

Measured memory_bytes: 13280
N = gets.chomp.to_i
ans = 0
num, score = [], []

0.upto(N-1) do |i|
  num[i], score[i] = gets.chomp.split(' ').map(&:to_i)
end

num.sort!
score.sort!

ans +=  num[N-1] - num[0] + 1
ans += num[0] - 1
ans += score[0]

p ans

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

int main(void){
    vector<int> A(3);
    for(int i=0; i<3; i++) cin >> A[i];
    sort(A.begin(), A.end());
    int a,b,c;
    a=A[0]; b=A[1]; c=A[2];

    if((2*c-a-b)%2==0) cout << (2*c-a-b)/2 << endl;
    else cout << (2*c+1-a-b)/2+1 << endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin>>n>>k;
    string s; cin>>s;
    s[k-1] += ('a'-'A');
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp4
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var q = from a in Console.ReadLine().Split(' ')
					select int.Parse(a);
			var aList = new List<int>(q).ToArray();
			var box = new int[n];

			int count = 0;
			var sb = new StringBuilder();
			for (int i = n; i > 0; i--)
			{
				int sum = 0;
				for (int j = i * 2; j <= n; j += i)
				{
					sum += box[j - 1];
				}
				if (sum % 2 != aList[i - 1])
				{
					box[i - 1] = 1;
					count++;
					sb.AppendFormat("{0} ", i);
				}
			}

			Console.WriteLine(count);
			Console.WriteLine(sb.ToString());
		}
	}
}


Measured memory_bytes: 35800
import java.util.Scanner;
class LongestIncreasingSubsequence {
    int[] a;
    LongestIncreasingSubsequence (int[] a) {
	this.a = a;
    }
    int solve (int n) {
	int[] len = new int[n];
	int length = 1;
	len[0] = a[0];
	for (int i = 1; i < n; i++) {
	    if (len[length - 1] < a[i]) {
		len[length++] = a[i];
	    } else {
		int pos = binarySearch(len, a[i], length - 1);
		len[pos] = a[i];
	    }
	}
	return length;
    }
    int binarySearch (int[] len, int a, int last) {
	int first = 0, middle;
	while (first <= last) {
	    middle = (first + last) / 2;
	    if (len[middle] < a) {
		first = middle + 1;
	    } else {
		last = middle - 1;
	    }
	}
	return first;
    }
}

public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	int[] a = new int[n];
	for (int i = 0; i < n; i++) {
	    a[i] = Integer.parseInt(scan.nextLine());
	}
	LongestIncreasingSubsequence lis = new LongestIncreasingSubsequence(a);
	System.out.println(lis.solve(n));
    }
}

Measured memory_bytes: 117404
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		String s = sc.next();
		sc.close();
		int[] q = new int[n];
		for(int i = 0 ; i < n ; i++) q[i] = (int)s.charAt(i) - 48;
		int yono = 0;
		int[] k = new int[3];
		int ke = 0;
		for(int i = 0 ; i < 1000 ; i++){
			k[2] = i % 10;
			k[1] = (i / 10) % 10;
			k[0] = (i / 100) % 10;
			ke = 0;
			boolean che = true;
			for(int j = 0 ; che && j < n ; j++){
				if(ke == 3){
					che = false;
					yono++;
				}else if(k[ke] == q[j]){
					ke++;
				}
				if(ke == 3){
					che = false;
					yono++;
				}
			}
		}
		ou.print(yono + "\n");
		ou.flush();
    }
}

Measured memory_bytes: 39688
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
using namespace std;
typedef long long ll;
ll n;
ll a[200];
ll sum[200]={0};
int main(void)
{
	scanf("%lld",&n);
	for(ll i=0;i<n;i++) scanf("%lld",&a[i]);
	ll mon=1000;
	for(ll i=0;i<n-1;i++)
	{
		sum[i]=a[i+1]-a[i];
	}
	vector<ll> vec;
	bool up=true;
	if(sum[0]>=0) vec.push_back(a[0]);
	if(sum[0]<0) up=false;
	ll st=0;
	for(ll i=1;i<n-1;i++)
	{
		if(sum[i]>=0&&!up)
		{
			vec.push_back(a[i]);
			up=!up;
		}
		else if(sum[i]<0&&up)
		{
			vec.push_back(a[i]);
			up=!up;
		}
	}
	if(vec.size()%2!=0&&a[n-1]>=a[n-2]) vec.push_back(a[n-1]);
	for(ll i=0;i<vec.size();i+=2)
	{
		ll k=mon/vec[i];
		mon=mon-vec[i]*k+vec[i+1]*k;
	}
	printf("%ld\n",mon);
}

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




int main()
{
	int A,B;
	cin >> A>>B;

	int ans=0;

	for (int i = A; i <= B; i++) {
		if (i / 10000 == i % 10 && (i / 1000) % 10 == (i / 10) % 10)
			ans++;
	}

	cout <<ans<< endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N, K, d, A[101]={}, i, j, temp, count=0;

	scanf("%d %d", &N, &K);

	for(i=0; i<K; i++){
		scanf("%d", &d);
		 for(j=0; j<d; j++){
		 	scanf("%d", &temp);
		 	A[temp-1]--;
		 }
	}

	for(i=0; i<N; i++){
		if(A[i]==0) count++;
	}

	printf("%d", count);
	return 0;
}


Measured memory_bytes: 1732
w, h, n = map(int, input().split())

x_min = 0
y_min = 0
x_max = w
y_max = h
for i in range(n):
    x, y, a = map(int, input().split())
    
    if a == 1:
        x_min = max(x_min, x)
    elif a == 2:
        x_max = min(x_max, x)
    elif a == 3:
        y_min = max(y_min, y)
    else:
        y_max = min(y_max, y)

if x_max <= x_min or y_max <= y_min:
    print(0)
else:
    print((x_max - x_min) * (y_max - y_min))

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

const int MAX_N = 201000;
bool prime[MAX_N];

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

  int N, P;

  vector<int> v1, v2;

  fill(prime, prime + MAX_N, true);
  prime[0] = prime[1] = false;
  for (int i = 2; i * i <= MAX_N; i++) {
    if (prime[i]) {
      for (int j = i + i; j < MAX_N; j += i) {
        prime[j] = false;
      }
    }
  }

  while (true) {
    cin >> N >> P;
    if (N == -1 && P == -1) break;

    v1.clear();
    v2.clear();

    int cnt = 0;
    for (int i = N + 1; cnt < P; i++) {
      if (prime[i]) {
        v1.push_back(i);
        cnt++;
      }
    }

    rep(i, P) {
      FOR(j, i, P) { v2.push_back(v1[i] + v1[j]); }
    }

    sort(all(v2));

    cout << v2[P - 1] << "\n";
  }

  return 0;
}


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

int main()
{
    char a,b;
   // freopen("inp.txt","r",stdin);
   cin>>a>>b;
    if(a=='H')
    {
        if(b=='H')
        {
            cout<<"H";
        }
        else
            cout<<"D";
    }
    else
    {
        if(b=='H')
        {
            cout<<"D";
        }
        else
            cout<<"H";

    }
    cout<<endl;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  int a,b,c; cin>>a>>b>>c;
  cout << a*b/2 << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
   char str1[50] , str2[50] ,str3[50] ;
   scanf("%s%s%s",str1,str2,str3);
   int count1=0 , count2  = 0  , i;

   for(i = 0 ;str1[i] != '\0' ; i++){
        count1++;
   }

   for(i = 0 ;str2[i] != '\0' ; i++){
        count2++;
   }



   if(str1[count1-1] ==str2[0] && str2[count2-1] == str3[0] ){
    printf("YES");
   }else{
   printf("NO");
   }
}


Measured memory_bytes: 128
#include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
long long a,b;
long long out;
int main(){
	cin >> a >> b ;
	long long x=0;
	if(a>=b) {
		if(a%b) x = min(a%b,llabs(a%b-b));
		else x=0;
	}
	else x = min(a,llabs(a-b));
	cout <<x<<endl;
}

Measured memory_bytes: 256