akhauriyash/Code-Regression huggingface dataset:
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val (a, b) = readIntList()
    print(a * b)
}


Measured memory_bytes: 36392
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
int main()
{
	int N, d[100000];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &d[i]);
	}
	sort(d, d + N);
	//printf("%d %d\n", d[N / 2 + 1], d[N / 2]);
	printf("%d", d[N / 2] - d[N / 2 - 1]);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <cmath>

using namespace std;

typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> pl;
typedef double db;

#define ini(x) int x; cin >> x
#define inl(x) ll x; cin >> x
#define ins(x) string s; cin >> x

#define out(x) cout << x
#define outb(x) cout << x << ' '
#define outn(x) cout << x << '\n'

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz size()
#define len length()
#define all(x) x.begin(), x.end()

#define forn(i, s, e) for (int i = s; i < e; i++)
#define forr(i, s, e) for (int i = s; i >= e; i--)
#define ford(i, s, e, d) for (int i = s; i < e; i += d)
#define fors(i, n) for (int i = 1; i*i <= n; i++)

int count(int n) {
	int ret = 0;
	while (n != 1) {
		n /= 2;
		ret++;
	}
	return ret+1;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	ini(l);
	int n = count(l), tmp = 1;
	outb(n);
	int cnt = 2*(n-1);
	forn(i, 0, n-1) if (l & (1<<i)) cnt++;
	outn(cnt);
	forn(i, 0, n-1) {
		int a = n-i-1, b = n-i;
		cout << a << ' ' << b << ' ' << 0 << '\n';
		cout << a << ' ' << b << ' ' << tmp << '\n';
		if (l & (1<<(a-1))) {
			tmp *= 2;
			cout << a << ' ' << n << ' ' << tmp << '\n';
			tmp++;
		} else {
			tmp *= 2;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
using lint =                            long long int;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD 1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }


/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
   string S;
   cin>>S;
   int ret = 0;
   REP(i,S.size()/2) ret += (S[i] != S[S.size() - 1 - i]);
   cout<<ret<<endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
double dp[3000][3000];

signed main(){
    int n;
    double p[2999];
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>p[i];
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
        for(int j=0;j<=i;j++)
            dp[i][j]=dp[i-1][j]*(1-p[i-1])+(j?dp[i-1][j-1]:0)*p[i-1];
    double ans=0;
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[n][i];
    cout<<setprecision(20)<<ans<<endl;
}


Measured memory_bytes: 68864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll , ll> P;
typedef pair<ll, ll> PL;
const ll INT_INF = 2147483646;
const ll ll_INF = 9223372036854775807;
ll mod = 1e9+7;

bool SecondCompare(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
	       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
	       return a.second>b.second;
}

int n, m;
int k[100],a[100][100],mem[100];

int main(){
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            cin >> a[i][j];
            mem[a[i][j]]++;
        }
    }

    int ans = 0;
    for(int i = 0; i <= m; i++){
        if(mem[i] == n) ++ans;
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

long long n, maxW;
long long dp[105][(int)1e5 + 3], weight[105], value[105];

long long solve(int item, int priceSoFar)
{
    if(item >= n)
    {
        if(priceSoFar == 0)
            return 0;
        return 1e17;
    }
    long long &ret = dp[item][priceSoFar];
    if(~ret)
        return ret;
    ret = 1e17;
    ret = min(ret, solve(item + 1, priceSoFar));
    if(priceSoFar - value[item] >= 0)
        ret = min(ret, solve(item + 1, priceSoFar - value[item]) + weight[item]);
    return ret;
}

int main()
{
    IO;
    cin >> n >> maxW;
    for(int i = 0; i < n; i++)
        cin >> weight[i] >> value[i];
    memset(dp, -1, sizeof dp);
    for(int currPrice = 1e5; currPrice >= 0; currPrice--)
    {
        long long seeWhatsTheWeightReturnedOnUsingCurrentPrice = solve(0, currPrice);
        if(maxW >= seeWhatsTheWeightReturnedOnUsingCurrentPrice)
        {
            cout << currPrice;
            return 0;
        }
    }
    return 0;
}


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

bool canMakeTriangle(int a, int b, int c) {
    bool ans = false;
    if (a + b > c && a - b < c && b - a < c) {
        ans = true;
    } else if (b + c > a && b - c < a && c - b < a) {
        ans = true;
    } else if (a + c > b && a - c < b && c - a < b){
        ans = true;
    }
    return ans;
}

int main() {
    int N; cin >> N;
    int L[N];
    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            for (int k = j + 1; k < N; k++) {
                if (canMakeTriangle(L[i], L[j], L[k]) && L[i] != L[j] && L[j] != L[k] && L[i] != L[k]) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}



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

using namespace std;

int main(){
  int n,i;
  scanf("%d",&n);
  vector<vector<int>>a(n,vector<int>(3,0));
  vector<vector<int>>dp(n,vector<int>(3,0));
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
  }
  dp[n-1][0] = a[n-1][0];
  dp[n-1][1] = a[n-1][1];
  dp[n-1][2] = a[n-1][2];
  for(i=n-2;i>=0;i--){
    dp[i][0] = a[i][0] + max(dp[i+1][1],dp[i+1][2]);
    dp[i][1] = a[i][1] + max(dp[i+1][0],dp[i+1][2]);
    dp[i][2] = a[i][2] + max(dp[i+1][0],dp[i+1][1]);
  }
  printf("%d",max({dp[0][0],dp[0][1],dp[0][2]}));
}


Measured memory_bytes: 11136
while True:
    m,f,r=map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif m+f >= 80:
        print('A')
    elif m+f >= 65 and m+f < 80:
        print('B')
    elif m+f >= 50 and m+f < 65:
        print('C')
    elif m+f >= 30 and m+f < 50 and r >= 50:
        print('C')
    elif m+f >= 30 and m+f < 50:
        print('D')
    elif m+f <= 30:
        print('F')


Measured memory_bytes: 5596
//Tag : #
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
 
#define Inf                     1001001001
using namespace std;
 
typedef long long int           ll;
typedef pair<ll, ll>            p_ll;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
typedef unsigned char           uchar;
typedef unsigned int            ui;
typedef unsigned long long int  ull;
/*************************************************/
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(); cout.tie();
  	int K, X;
	cin >> 	K >> X;
  	if( K * 500 >= X)
      	cout << "Yes" <<endl;
  	else
      	cout << "No" <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<algorithm>

long long dp[100 + 1][20 + 1];
int k[100 + 1];

bool check(int);

using namespace std;

int main() {
	int n;

	cin >> n;
	for (int i = 0; i < n; i++) cin >> k[i];

	memset(dp, 0, sizeof(dp));
	dp[0][k[0]] = 1;
	for (int i = 1; i < n-1; i++) {
		for (int j = 0; j <= 20; j ++ ) {
			if (check(j - k[i]) == true) dp[i][j] += dp[i - 1][j - k[i]];
			if (check(j + k[i]) == true) dp[i][j] += dp[i - 1][j + k[i]];
		}
	}

	cout << dp[n-2][k[n-1]] << endl;
	//cin >> n;
	return 0;
}

bool check(int t) {
	if (t >= 0 && t <= 20) return true;
	return false;
}


Measured memory_bytes: 3152
from numpy import*
(_,k),A,F=[int64(t.split())for t in open(0)]
l=-1
r=10**12
while r-l>1:
 m=l+r>>1
 if sum(A-minimum(sort(A),m//sort(F)[::-1]))>k:l=m
 else:r=m
print(r)

Measured memory_bytes: 37236
#include <cstdio>
#include <iostream>

using namespace std;

int main() {
	int n;
	while (scanf("%d", &n), n) {
		int ans = 0;
		while (n) {
			ans += n / 5;
			n /= 5;
		} 
		printf ("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vi a(N * 100 + 1);
    a[0] = 1;
    int t = 0, ans = 0;
    rep(i, N) {
        int s;
        cin >> s;
        for (int j = t; j >= 0; --j) if(a[j]){
            a[j + s] = 1;
            if ((j + s) % 10)smax(ans, j + s);
        }
        t += s;
    }
    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
static const ll N_MAX = 100100;

ll N,M;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};



int main() {
    cin >> N >> M;
    UnionFind uf(N);
    vector<ll> A(M),B(M);
    for(int i=0;i<M;i++){
        cin >> A[i] >> B[i];
        A[i]--;B[i]--;
    }
    ll tmp=N*(N-1)/2;
    vector<ll> res;
    for(int i=0;i<M;i++){
        res.push_back(tmp);

        if(uf.issame(A[M-1-i],B[M-1-i])) continue;

        ll sa = uf.size(A[M-1-i]),sb = uf.size(B[M-1-i]);
        tmp-=sa*sb;
        uf.merge(A[M-1-i],B[M-1-i]);
    }
    reverse(res.begin(),res.end());
    for(int i=0;i<res.size();i++){
        cout << res[i] << endl;
    }

}

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,i=0,max = 0,cnt=0;
  
  cin >> N;
  int A[N];
  for(i=0;i<N;i++){
    cin >> A[i];
  }
  
  for(i=0;i<N-1;i++){
    if(A[i] >= A[i+1]){
      cnt++;
      if(cnt > max) max=cnt;
    }else{
      cnt = 0;
    }
  }

  cout << max << endl;
  

  return 0;
}


Measured memory_bytes: 640
def zeroPadding(num):
    return "%06d"%num

def zeroPadding10(num):
    return "%010d"%num

class Row:
    def __init__(self, i, pref_id, year):
        self.i = i
        self.pref_id = pref_id
        self.year = year
        self.city_id = -1
        
    def __str__(self):
        return "{i: %d, pref_id: %d, year: %d, city_id: %d}"%(self.i, self.pref_id, self.year, self.city_id)
        
    def set_city_id(self, city_id):
        self.city_id = city_id
            
    def get_sort_key(self):
        return zeroPadding(self.pref_id ) + zeroPadding10(self.year) 
            
    def get_str(self):
        return zeroPadding(self.pref_id ) + zeroPadding(self.city_id)

N, M = map(int,input().split()) 

row_list = []

for i in range(M):
    d = list(map(int,input().split())) 
    row_list.append(Row(i, d[0], d[1]))

row_list = sorted(row_list, key=lambda x: x.get_sort_key())

now_pref_id = -1
cnt = 1

result = []
for i, row in enumerate(row_list):
    if row.pref_id != now_pref_id:
        now_pref_id = row.pref_id
        cnt = 1
    
    row.set_city_id(cnt)
    row_list[i] = row
    cnt += 1

[print(x.get_str()) for x in sorted(row_list, key=lambda x: x.i)]

Measured memory_bytes: 50252
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,i;
  cin >> n;
  string s1,s2;
  int t=0,h=0;
  for(i=0;i<n;i++){
    cin >> s1 >> s2;
    if(s1.compare(s2)==0) {
      t++;h++;
    }else if(s1.compare(s2)>0) t+=3;
    else h+=3;
  }
  cout << t << " " << h << endl;
}


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

int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};

int H, W, N;
vector<string> mp;
int goal[10][2];

int solve(int si, int sj, int gi, int gj){
  int d[1000][1000];
  queue<pair<int, int> > que;
  memset(d, -1, sizeof(d));
  que.push(pair<int, int>(si, sj));
  d[si][sj]=0;
  while(que.size()){
    pair<int, int> now=que.front(); que.pop();
    if(now.first==gi && now.second==gj)break;
    for(int i=0; i<4; i++){
      int nx=now.first+dir[i][0], ny=now.second+dir[i][1];
      if(0<=nx && nx<H && 0<=ny && ny<W && mp[nx][ny]!='X' && d[nx][ny]==-1){
        que.push(pair<int, int>(nx, ny));
        d[nx][ny]=d[now.first][now.second]+1;
      }
    }
  }
  return d[gi][gj];
}

int main(){
  cin >> H >> W >> N;
  for(int i=0; i<H; i++){
    string s;
    cin >> s;
    mp.push_back(s);
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(mp[i][j]=='S'){goal[0][0]=i; goal[0][1]=j;}
      if('1'<=mp[i][j] && mp[i][j]<='9'){goal[mp[i][j]-'0'][0]=i; goal[mp[i][j]-'0'][1]=j;}
    }
  }
  int ans=0;
  for(int i=0; i<N; i++){
    ans+=solve(goal[i][0], goal[i][1], goal[i+1][0], goal[i+1][1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5952
// package app;

import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

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

        // final String a = sc.next();
        // final String b = sc.next();

        final int x = sc.nextInt();
        // final int b = sc.nextInt();
        // final int D = sc.nextInt();
        // System.out.println();

        System.out.println(x < 1200 ? "ABC" : "ARC");

        // System.out.println(A <= X && A + B >= X ? "YES" : "NO");

    }
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

const int d4[4][2] = {
        {1, 0}, {0, 1}, {-1, 0}, {0, -1}
};

struct Q {
    int r, c; ll dist;
    bool operator<(const Q& ri) const {
        return dist < ri.dist;
    }
    bool operator>(const Q& ri) const {
        return ri < *this;
    }
};


int main() {
    int h, w; ll a, b;
    cin >> h >> w >> a >> b;
    auto is_bc = [&](int r, int c) {
        return 0 <= r && r < h && 0 <= c && c < w;
    };
    V<string> g(h);
    VV<int> ok(h, V<int>(w, 1));
    int sr, sc, tr, tc;

    for (int i = 0; i < h; i++) {
        cin >> g[i];
        for (int j = 0; j < w; j++) {
            if (g[i][j] == 's') {
                sr = i; sc = j;
            }
            if (g[i][j] == 'g') {
                tr = i; tc = j;
            }
            if (g[i][j] == '*') {
                for (int dx = -1; dx <= 1; dx++) {
                    for (int dy = -1; dy <= 1; dy++) {
                        int ni = i + dx, nj = j + dy;
                        if (!is_bc(ni, nj)) continue;
                        ok[ni][nj] = 0;
                    }
                }
            }
        }
    }

    VV<int> vis(h, V<int>(w, 0));
    VV<ll> dist(h, V<ll>(w, TEN(18)));
    priority_queue<Q, V<Q>, greater<>> que;
    que.push({sr, sc, 0LL});
    dist[sr][sc] = 0;
    while (!que.empty()) {
        Q q = que.top(); que.pop();
        int r = q.r, c = q.c;
        if (r == tr && c == tc) break;
        if (vis[r][c]) continue;
        vis[r][c] = true;
        auto check = [&](int nr, int nc, ll ed) {
            if (!is_bc(nr, nc)) return;
            if (dist[r][c] + ed < dist[nr][nc]) {
                dist[nr][nc] = dist[r][c] + ed;
                que.push({nr, nc, dist[nr][nc]});
            }
        };
        for (int d = 0; d < 4; d++) {
            int nr = r + d4[d][0], nc = c + d4[d][1];
            if (!is_bc(nr, nc)) continue;
            if (g[nr][nc] != '#') {
                check(nr, nc, a);
            } else if (ok[r][c]){
                check(nr, nc, a + b);
            }
        }
        if (ok[r][c]) {
            for (int dr = -1; dr <= 1; dr++) {
                for (int dc = -1; dc <= 1; dc++) {
                    int nr = r + dr, nc = c + dc;
                    if (!is_bc(nr, nc)) continue;
                    check(nr, nc, a + a + b);
                }
            }
        }
    }
    ll ans = dist[tr][tc];
    if (ans >= TEN(17)) cout << "INF" << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 19620
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	long long int x, y;
	cin >> x >> y;
	if(abs(x - y) > 1) cout << "Alice" << endl;
	else cout << "Brown" << endl;
	return 0;
}

Measured memory_bytes: 256
l=input().split()
n=int(l[0])
k=int(l[1])
tot=[]
for i in range(k):
    l=input().split()
    li=[int(i) for i in l]
    tot.append(li)
dp=[0 for i in range(n)]
pref=[1]
dp[0]=1
sumi=1
for i in range(1,n):
    for j in range(k):
        r=tot[j][1]
        l=tot[j][0]
        if(i-l>=0):
            dp[i]+=pref[i-l]
        if(i-r-1>=0):
            dp[i]-=pref[i-r-1]
    dp[i]%=998244353
    sumi+=dp[i]
    sumi%=998244353
    pref.append(sumi)
#print(dp)
#print(pref)
print(dp[-1])


Measured memory_bytes: 83840
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename Tuple, size_t N>
struct TuplePrinter {
  static void print(const Tuple &t) {
    TuplePrinter<Tuple, N-1>::print(t);
    cout << ", " << get<N-1>(t);
  }
};

template<typename Tuple>
struct TuplePrinter<Tuple, 1> {
  static void print(const Tuple &t) {
    cout << get<0>(t);
  }
};

template<typename... T>
ostream &operator<<(ostream &os, const tuple<T...> &tup) {
  os << "(";
  TuplePrinter<decltype(tup), sizeof...(T)>::print(tup);
  return os << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }


int main() {
  int n; cin>>n;
  string c; cin>>c;

  long long ans = 0;
  int l = 0, r = n-1;
  while (l < r) {
    if (c[l] == 'R') {
      ++l;
      continue;
    }
    if (c[r] == 'W') {
      --r;
      continue;
    }
    ++ans;
    ++l;
    --r;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define print(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define pii pair<int,int> 
#define pdd pair<ld,ld> 
#define ld double
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define X first
#define Y second
#define oset tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int x = 864197532, N = 50000;
const long long mod = 9223372036854775807;
const double eps = 1e-6, Pi = 3.1415926535;

int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	lli now = 1, tmp;
	bool is = false;
	ld tt = 0;
	fop (i,0,n) {
		cin >> tmp;
		now *= tmp;
		tt += (long double)(log10(tmp));
		if (tmp == 0) {
			is = true;
		}
	}
	lli aa = 1000000000ll * 1000000000;
	if (is) {
		cout << 0 << endl;
	} else if (tt > 18) {
		cout << -1 << endl;
	} else {
		if (now <= aa) cout << now << endl;
		else cout << -1 << endl;
	}
}

Measured memory_bytes: 4024
//29/12/2019
#include<bits/stdc++.h>

using namespace std;

#define debug printf("Debug\n");
#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define p_b(x) push_back(x)
#define m_p(x) make_pair(x,y)

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};
vector<ll>v;
char last[200005];

int main(){
    _fastio
    ll n,k;
    cin>>n>>k;
    ll r,s,p;
    cin>>r>>s>>p;

    string str;
    cin>>str;

    ll ans=0;
    for(ll i=0;i<=k-1;i++){
        if(str[i]=='s'){
            ans+=r;
            last[i]='r';
        }
        else if(str[i]=='p'){
            ans+=s;
            last[i]='s';
        }
        else{
            ans+=p;
            last[i]='p';
        }

        for(ll j=i+k;j<n;j+=k){
            if(str[j]=='s'){
                if(last[j-k]!='r'){
                    ans+=r;
                    last[j]='r';
                }
                else{
                    if(j+k>=n)
                        last[j]='s';
                    else{
                        if(str[j+k]=='p') last[j]='p';
                        else last[j]='s';
                    }
                }
            }
            else if(str[j]=='p'){
                if(last[j-k]!='s'){
                    ans+=s;
                    last[j]='s';
                }
                else{
                    if(j+k>=n)
                        last[j]='p';
                    else{
                        if(str[j+k]=='r') last[j]='r';
                        else last[j]='p';
                    }
                }
            }
            else{
                if(last[j-k]!='p'){
                    ans+=p;
                    last[j]='p';
                }
                else{
                    if(j+k>=n)
                        last[j]='r';
                    else{
                        if(str[j+k]=='s') last[j]='s';
                        else last[j]='r';
                    }
                }
            }
        }
    }

    //for(ll i=0;i<n;i++) cout<<last[i]; cout<<endl;

    cout<<ans<<endl;




    return 0;
}


Measured memory_bytes: 592
#include<stdio.h>


int main()
{
	int i,j,a[3];
	for(i=0;i < 3;i++) scanf("%d",&a[i]);

	for (i = 0; i < 2; i++) {
		for (j = 2; j > i; j--) {
			if (a[j - 1] > a[j]) {
				int change = a[j];
				a[j] = a[j - 1];
				a[j-1] = change;
			}
		}
	}
	printf("%d %d %d\n",a[0],a[1],a[2]);
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
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 INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n*a, b) << endl;
}

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

int main()
{
    int a,ans=0;
    string s;
    cin>>s;
    a=s.size();
    if(s[0]=='k'){
        if(s[1]=='e'){
            if(s[2]=='y'){
                if(s[3]=='e'){
                    if(s[4]=='n'){
                        if(s[5]=='c'){
                            if(s[6]=='e'||s[a-1]=='e'){
                                ans=1;
                            }
                        }
                        else if(s[a-2]=='c'&&s[a-1]=='e'){
                            ans=1;
                        }
                    }
                    else if(s[a-3]=='n'&&s[a-2]=='c'&&s[a-1]=='e'){
                        ans=1;
                    }
                }
                else if(s[a-4]=='e'&&s[a-3]=='n'&&s[a-2]=='c'&&s[a-1]=='e'){
                    ans=1;
                }
            }
            else if(s[a-5]=='y'&&s[a-4]=='e'&&s[a-3]=='n'&&s[a-2]=='c'&&s[a-1]=='e'){
                ans=1;
            }
        }
        else if(s[a-6]=='e'&&s[a-5]=='y'&&s[a-4]=='e'&&s[a-3]=='n'&&s[a-2]=='c'&&s[a-1]=='e'){
            ans=1;
        }
    }
    else if(s[a-7]=='k'&&s[a-6]=='e'&&s[a-5]=='y'&&s[a-4]=='e'&&s[a-3]=='n'&&s[a-2]=='c'&&s[a-1]=='e'){
        ans=1;
    }
    if (ans==1)cout<<"YES";
    else cout<<"NO";
}

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

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using int128 = __int128;
using cint = cpp_int;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)

// Stream
#define input(a) scanf("%lld", &(a))
#define output(a) printf("%lld\n", (a))
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }

signed main() {
    ll N, M, ANS = 0;
    cin >> N >> M;
    inc(i, 1, sqrt(M)) {
        if (M % i == 0 && M / i >= N) {
            ANS = max(ANS, i);
        }
        if (M % i == 0 && i >= N) {
            ANS = max(ANS, M / i);
        }
        debug(i, M / i);
    }
    cout << ANS << endl;
}

// for compilation: g++ -O3 -o _ _.cpp -std=c++17


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[25][25];
int vis[25][25],n,m,ans=0;
int xx[4]={0,0,1,-1};
int yy[4]={1,-1,0,0};
int cx,cy;
int bfs(int x,int y)
{
    int ma=0;
    cx=x;cy=y;
    memset(vis,0,sizeof(vis));
    queue<pair<int,int> > q;
    q.push(make_pair(x,y));
    while(!q.empty()){
        pair<int,int> p=q.front();q.pop();
        for(int i=0;i<4;i++){
            x=p.first+xx[i];
            y=p.second+yy[i];
            if(x==0||y==0||x>n||y>m||(x==cx&&y==cy)){
                ma=max(ma,vis[p.first][p.second]);
                continue;
            }
            else if(s[x][y]=='#'||vis[x][y]!=0){
                ma=max(ma,vis[p.first][p.second]);
                continue;
            }
            vis[x][y]=vis[p.first][p.second]+1;
            q.push(make_pair(x,y));
        }
    }
    return ma;
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i][j]=='#') continue;
            ans=max(ans,bfs(i,j));
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N = int(input())
ans = 0
for _ in range(N):
    x, u = input().split()
    x = float(x)
    if u == 'BTC':
        ans += x * 380000
    else:
        ans += x
print(ans)


Measured memory_bytes: 63980
#include<iostream>
using namespace std;
int main() {

	int d;
	cin >> d;
	int c[26];
	int i, j;
	for (i = 0; i < 26; i++) {
		cin >> c[i];
	}
	int s[365][26];
	for (i = 0; i < d; i++) {
		for (j = 0; j < 26; j++) {
			cin >> s[i][j];
		}
	}
	int last[26];
	for (i = 0; i < 26; i++) {
		last[i] = 0;
	}
	int jmax, jindex;
	for (i = 1; i <= d; i++) {

		jmax = 0;
		jindex = -1;
		for (j = 0; j < 26; j++) {
			if (c[j] *(i - last[j]) > jmax) {
				jmax = c[j] *(i - last[j]);
				jindex = j;
			}
			else if (c[j] *(i - last[j]) == jmax) {
				if (s[i - 1][j] > s[i - 1][jindex]) {
					jindex = j;
				}
			}
		}
		for (j = 0; j < 26; j++) {
			if (s[i - 1][j] + 10 * c[j] * (i - last[j]) >= jmax) {
				jmax = s[i - 1][j] + 10 * c[j] * (i - last[j]);
				jindex = j;
			}
		}
		last[jindex] = i;
		cout << jindex + 1 << endl;
		


	}
	return 0;


}

Measured memory_bytes: 3672
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
template <typename Functor>
struct fix_type
{
    Functor functor;
    template <typename... Args>
    decltype(auto) operator()(Args&&... args) const& { return functor(functor, std::forward<Args>(args)...); }
};
template <typename Functor>
fix_type<typename std::decay<Functor>::type> fix(Functor&& functor) { return {std::forward<Functor>(functor)}; }

int main()
{
    int N;
    ll X, D;
    cin >> N >> X >> D;
    vector<ll> m(N);
    cin >> m[0];
    vector<vector<int>> edge(N);
    for (int i = 1; i < N; i++) {
        cin >> m[i];
        int p;
        cin >> p;
        edge[p - 1].push_back(i);
    }
    auto mrec = fix([&](auto&& self, const int s) -> ll {
        ll sum = m[s];
        for (const int to : edge[s]) { sum += self(self, to); }
        return m[s] = sum;
    });
    vector<ll> s(N, 0);
    auto srec = fix([&](auto&& self, const int i) -> ll {
        ll sum = 1;
        for (const int to : edge[i]) { sum += self(self, to); }
        return s[i] = sum;
    });
    mrec(0);
    srec(0);
    using P = pair<ll, ll>;
    vector<P> obj;
    for (int i = 0; i < N; i++) {
        ll num = i == 0 ? X : D;
        ll n = 1;
        for (; (n << 1) - 1 <= num; n <<= 1) {
            if ((double)m[i] * n <= X) { obj.push_back({m[i] * n, s[i] * n}); }
        }
        const ll res = num - (n - 1);
        if (res > 0 and (double) m[i] * res <= X) { obj.push_back({m[i] * res, s[i] * res}); }
    }
    auto comp = [](const P& p1, const P& p2) {
        const ll x = p1.first * p2.second - p1.second * p2.first;
        return x != 0 ? x < 0 : p1.first > p2.first;
    };
    const int size = (int)obj.size();
    sort(obj.begin(), obj.end(), comp);
    ll ans = 0;
    auto rec = fix([&, size](auto&& self, const int ind, const ll value, const ll rest) {
        if (ind == size) {
            ans = max(ans, value);
            return;
        }
        if (rest >= obj[ind].first) {
            ll greedy = value + obj[ind].second;
            ll res = rest - obj[ind].first;
            for (int i = ind + 1; i < size; i++) {
                if (res > obj[i].first) {
                    greedy += obj[i].second, res -= obj[i].first;
                } else if (res > 0) {
                    greedy += obj[i].second * res / obj[i].first;
                    break;
                }
            }
            if (greedy > ans) { self(self, ind + 1, value + obj[ind].second, rest - obj[ind].first); }
        }
        self(self, ind + 1, value, rest);
    });
    rec(0, 0, X);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
#define fi first
#define se second
#define pb push_back

int main(){
// ios::sync_with_stdio(false);
LL K, N = 50, arr[50];  

cin >> K;
cout << N << endl;

LL mn = (K / N);

K %= N;

for(LL i = 0; i < N; i++)
	arr[i] = mn + i;

for(LL i = 0; i < K; i++){
	LL mini = 0;
	for(LL i = 0; i < N; i++)
		if(arr[mini] > arr[i])
			mini = i;

	for(LL i = 0; i < N; i++)
		if(i == mini)
			arr[i] += N;
		else arr[i] -= 1;
	
}

for(LL i = 0; i < N; i++)
	cout << arr[i] << ' ';

} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX_C = 60;
const int MAX_T = 150;

int c[MAX_C],t[MAX_T];

void init_c(){
  for(int i = 0 ; i < MAX_C ; i++){
    c[i] = i*i*i;
  }
}

void init_t(){
  for(int i = 2 ; i < MAX_T ; i++){
    t[i-2] = i*(i-1)*(i-2)/6;
  }
}

int main(){
  int n;

  init_c();
  init_t();

  while(cin >> n ,n){
    int ans = 0;

    for(int i = 0 ; i < MAX_C ; i++){
      for(int j = 0 ; j < MAX_T-2 ; j++){
	if(c[i]+t[j] <= n){
	  ans = max(ans , c[i] + t[j]);
	}
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
N = gets.to_i
V_n = gets.split.map(&:to_i)
C_n = gets.split.map(&:to_i)

ans = 0
N.times do |i|
  if V_n[i] > C_n[i]
    ans += V_n[i] - C_n[i]
  end
end
p ans

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var di = new Dictionary<long, int>();
		for(int i=0;i<N;i++){
			if(!di.ContainsKey(A[i])) di.Add(A[i], 0);
			di[A[i]]++;
		}
		
		int cnt = 0;
		for(int j=33;j>=0;j--){
			var t = 1L << j;
			var l = di.Keys.ToList();
			for(int i=0;i<l.Count;i++){
				if(l[i] >= t) continue;
				if(di[l[i]] > 0 && di.ContainsKey(t - l[i]) && di[t - l[i]] > 0){
					if(l[i] == t - l[i]){
						int c = di[l[i]] / 2;
						di[l[i]] -= 2 * c;
						cnt += c;
					} else {
						int c = Math.Min(di[l[i]], di[t - l[i]]);
						di[l[i]] -= c;
						di[t - l[i]] -= c;
						cnt += c;
					}
				}
			}
			
		}
		Console.WriteLine(cnt);
	}
	int N;
	long[] A;
	public Sol(){
		N = ri();
		A = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 51220
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        h: usize
    }
    let mut b = 1;
    while b <= h {
        b <<= 1;
    }
    println!("{}", b - 1);
}


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

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define FILL0(x) memset(x,0,sizeof(x))
#define FILL1(x) memset(x,-1,sizeof(x))

using namespace std;

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

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 (b<a) { a=b; return 1; } return 0; }
 

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

    int n;
    cin >> n;

    int a[n];
    rep(i, n)
    {
        cin >> a[i];
    }

    int ans = 0;
    rep(i, n)
    {
        if(i%2==0)
        {
            if(a[i]%2==1)
                ans++;
        }
    }

    cout << ans << endl;



    return 0;

}



Measured memory_bytes: 3580
#include <stdio.h>

void main(void){
  int N,X;
  scanf("%d",&N);
  for(X=0;X<50000;X++){
    if(X*108/100==N){
      printf("%d\n",X);
      break;
    }
    else if(X*108/100>N){
      puts(":(");
      break;
    }
  }
}

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

int a[100005], cnt[100005];

int main(){
    
    int n, k, q; cin >> n >> k >> q;
    for(int i = 0; i < q; i++){
        cin >> a[i];
        cnt[a[i]]++;
    }
    
    for(int i = 1; i <= n; i++){
        if(k-(q-cnt[i]) <= 0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                                #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<int,int>
                                        #define ppap pair<pa,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-10)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;


int gcd(int a,int b){
	if(a<b) return gcd(b,a);
	if(b==0) return a;
	if(a%b==0) return b;
	return gcd(b,a%b);
}
set<string >se;
           signed main(){
               int n,m;
 			cin>>n;
           	for(int i=0;i<n;i++){
           	
           	string s,t;
           		cin>>s>>t;
           		if(s[0]=='i')se.insert(t);
           		else cout<<(se.find(t)==se.end()? "no":"yes")<<endl;
           	}
           	
           	
      //     	cout<<ans<<endl;
           }
             

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

int main() {
        int x;
        set<int> s;

        cin >> x;

        s.insert(1);
        for (int i = 2; i <= 33; ++i) {
                for (int j = 2; j <= 10; ++j) {
                        int result= pow(i, j);
                        if (result <= 1000)
                                s.insert(result);
                        else
                                break;
                }
        }

        for (int n = x; n >= 1; --n) {
                if (s.find(n) != s.end()) {
                        cout << n << endl;
                        break;
                }
        }
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int D, G;
	cin >> D >> G;

	pairs(X);
	fx(D) {
		pairsp(X);
	}
	int ans = INT_MAX;
	fx((int)pow(3,D)) {

		int y = x;
		int i = 0;
		int z = -1;
		ll sum = 0;
		int res = 0;
		bool flag = false;
		while (y>0) {
			if (y%3==1) {
				sum += X[i].first * (i + 1) * 100 + X[i].second;
				res += X[i].first;
			}
			else if (y%3==2) {
				if (z>=0) {
					flag = true;
					break;
				}
				else {
					z = i;
				}
			}
			i++;
			y /= 3;
		}
		
		if (flag) {
			continue;
		}
		if (z<0) {
			if(sum>=G)
			ans = min(ans, res);
		}
		else {
			fw(X[z].first) {
				int val = (w + 1) * 100 * (z + 1) + (w == X[z].first -1? X[z].second : 0);
				if (sum+val>=G) {
					ans = min(ans,res+w+1);
					break;
				}
			}
		}
	}

	ce(ans)

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll> 
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,p=-2,q=1,val=0;cin>>n;
  string ans;
  if(n==val) ans+='0';
  while(n!=val) {
    ll num=abs(q*p);
    ll a=n%num;
    ll b=val%num;
    while(a<0) a+=num;
    while(b<0) b+=num;
    if(a==b) {ans+='0';q*=p;}
    else {val+=q;q*=p;ans+='1';}
  }
  reverse(ans.begin(),ans.end());
  print(ans);
  return 0;
}

Measured memory_bytes: 256
Q = 998244353
N = int( input())
A = [ int( input()) for _ in range(N)]
S = sum(A)
H = (S+1)//2
dp = [0]*(S+1)
dp[0] = 1
for a in A:
    for s in range(S, a-1, -1):
        dp[s] = (dp[s]*2 + dp[s-a])%Q
    for s in range(a-1,-1,-1):
        dp[s] = dp[s]*2%Q
ans = (pow(3, N, Q) - sum(dp[H:])%Q*3%Q)%Q
if S%2 == 0:
    dp = [0]*(S+1)
    dp[0] = 1
    for a in A:
        for s in range(S,a-1,-1):
            dp[s] = (dp[s] + dp[s-a])%Q
    ans += dp[H]*3
    ans %= Q
print(ans)

Measured memory_bytes: 42972
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n;
LL a;

LL gcd(LL a, LL b){
	if(b == 0) return a;
	return gcd(b, a % b);
}

int main(){
	scanf("%d", &n);
	LL ans = 1ll;
	for(int i = 1; i <= n; i ++){
		scanf("%lld", &a);
		ans = a / gcd(a, ans) * ans;
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
using namespace std;

typedef long long ll;
const ll mod = 1e9+7;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    ll n; cin >> n; ll res = 1;
    for(int i=1; i<=n; i++) res = res * i % mod;
    cout << res;
}

Measured memory_bytes: 3616