akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e15 + 7;
constexpr int64_t MIN = -(1LL << 60);

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

  int32_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (auto& a : A) {
    cin >> a;
  }

  vector<vector<vector<int64_t>>> dp(N+1, vector<vector<int64_t>>(2, vector<int64_t>(3, MIN)));
  dp[0][1][0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 3; k++) {
        if (k + j < 3) dp[i+1][1][k+j] = max(dp[i+1][1][k+j], dp[i][j][k]);
        if (j == 1) dp[i+1][0][k] = max(dp[i+1][0][k], dp[i][1][k] + A[i]);
      }
    }
  }
  if (N%2 == 0) cout << max(dp[N][1][0], dp[N][0][1]) << endl;
  else cout << max(dp[N][0][2], dp[N][1][1]) << endl;
  return 0;
}


Measured memory_bytes: 34616
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){
	map<string,int> m;
	m.insert(make_pair("MON",1));
	m.insert(make_pair("TUE",2));
	m.insert(make_pair("WED",3));
	m.insert(make_pair("THU",4));
	m.insert(make_pair("FRI",5));
	m.insert(make_pair("SAT",6));
	m.insert(make_pair("SUN",7));
	string s;
	cin>>s;
	int temp=m["SUN"]-m[s];
	if(temp==0)
		cout<<7;
	else 
		cout<<temp;
	return 0;
}

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

		String c = s.substring(0,1);
		int count = 0;
		for(int i=0; i<s.length(); i++){
			if(!c.equals(s.substring(i,i+1))){
				count++;
				c = s.substring(i,i+1);
			}
		}

		System.out.println(count);
	}
}

Measured memory_bytes: 22132
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define SUM(n) ((n)+1)*(n)/2
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = (1e9)+7;
#define all(v) v.begin(),v.end()
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

  int n;
  cin >> n;
  string s;
  int alpha[50][50] = {};
  rep(i,n){
    cin >> s;
    rep(j, s.size()){
      alpha[i][s[j] - 'a'] ++;
    }
  }
  rep(i, 26){
    int minv = INF;
    rep(j, n){
      minv = min(minv, alpha[j][i]);
    }
    rep(j, minv){
      cout << (char)('a' + i);
    }
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 256
// Author : Mohamed Sameh
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
typedef long long ll ;
using namespace std ;
string x ;
bool pal (int l , int r )
{
    if (l >= r )return 1 ; 
    if (x[l] != x[r])return 0; 
    return pal(l+1, r-1); 
}
int main()
{
    cin >> x ;
    int n = SZ(x);
    if ((n & 1) && pal(0 , n-1) && pal(0 , (n-1)/2  - 1) && pal((n+3)/2 - 1 , n-1 ))
    {
        cout <<"Yes\n"; 
    }else 
    cout <<"No\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ
void cnt(vector<int> vec){
    int n = SZ(vec) ;
    int cnt=0 ;
    bool flag = true ;
    while(flag){
        flag = false ;
        for(int j=n-1;j>0;j--){
            if(vec.at(j)<vec.at(j-1)){
                int swap = vec.at(j-1) ;
                vec.at(j-1) = vec.at(j) ;
                vec.at(j) = swap ;
                cnt++ ;
              flag = true ;
            }
        }
    }
    cout << cnt <<endl ;
}

void print(vector<int> vec){
    int n = SZ(vec) ;
    sort(ALL(vec)) ;
    REP(i,n){
        cout << vec.at(i) ;
        if(i!=n-1){
            cout <<" ";
        }
    }
    cout <<endl ;
}


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


int main()
{
    int n ;
	cin >> n ;
    vector<int> vec(n) ;
    REP(i,n){
        cin >> vec.at(i) ;
    }
    print(vec) ;
    cnt(vec) ;
    return 0 ;
}




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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N; cin >> N;
  ll result = 0;
  repr(i,1,N+1) if (i%3&&i%5) result += i;
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	int i, l[10], v[2], d[11], sum;
	double cross;
	
	while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&l[0],&l[1],&l[2],&l[3],&l[4],&l[5],&l[6],&l[7],&l[8],&l[9],&v[0],&v[1]) != EOF){

		d[0] = 0;
		sum = 0;

		for(i=0; i<10; i++){
			sum += l[i];
			d[i+1] = sum;
		}

		cross = sum * ((double)v[0] / (v[0] + v[1]));

		for(i=0; i<10; i++){
			if(cross > d[i] && cross <= d[i+1]){
				printf("%d\n", i+1);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int) N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=(int) n;i--)
#define p(s) cout<<(s)<<endl
#define DEBUG(x,y) cout<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl;
#define CK(n,a,b) ((a)<=(n)&&(n)<=(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9+7;


string s;
int main(){
	cin>>s;
	bool flag=false;
	string ans="No";
	REP(i,0,s.size()){
		if(s[i]=='C'&&!flag){
			flag=true;
		}else if(s[i]=='F'&&flag){
			ans="Yes";
		}
	}
	p(ans);
	return 0;
}


Measured memory_bytes: 256
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long N = lread();
    auto T = lreads(N);
    long ans = T[0];
    foreach (t; T[1 .. $])
        ans = lcm(ans, t);
    writeln(ans);
}

T lcm(T)(T a, T b)
{
    return a / gcd(a, b) * b;
}


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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(4e2) + 17;

int n, c;
int A[MAXN], B[MAXN];
ll f[MAXN][MAXN], dp[MAXN][MAXN];

bool read() {
    if (!(cin >> n >> c))
        return false;

    forn (i, n)
        cin >> A[i + 1];

    forn (i, n)
        cin >> B[i + 1];

    return true;
}

void add(ll& a, ll b) {
    a += b;

    if (a >= INF)
        a -= INF;
}

ll binpow(ll a, ll n) {
    ll res = 1ll;

    for (; n > 0; n /= 2, a = a * a % INF)
        if (n & 1)
            res = res * a % INF;

    return res;
}

void solve() {
    for (int i = 1; i <= n; ++i)
        for (int p = 0; p <= c; ++p)
            for (int x = A[i]; x <= B[i]; ++x)
                add(f[i][p], binpow(x, p));

    dp[0][0] = 1;

    for (int i = 0; i < n; ++i)
        for (int s = 0; s <= c; ++s)
            for (int p = 0; p + s <= c; ++p)
                add(dp[i + 1][s + p], dp[i][s] * f[i + 1][p] % INF);

    cout << dp[n][c] << endl;
}

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



Measured memory_bytes: 2944
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector< pair<int, int> > xy(N);
    for(int i=0; i<N; i++){
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        xy[i]=make_pair(tmp1, tmp2);
    }
    
    vector< pair<int, int> > pq(N*(N-1));
    int cnt=0;
    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            pq[cnt]=make_pair(xy[i].first-xy[j].first, xy[i].second-xy[j].second);
            cnt++;
            pq[cnt]=make_pair(xy[j].first-xy[i].first, xy[j].second-xy[i].second);
            cnt++;
        }
    }
    int ans=0;//削減できるコストの最大値
    for(int p=0; p<(N-1)*N; p++){
        int tmp=0;
        for(int i=0; i<N-1; i++){
            for(int j=i+1; j<N; j++){
                if(pq[p].first==xy[i].first-xy[j].first && pq[p].second==xy[i].second-xy[j].second) tmp++;
                else if(pq[p].first==xy[j].first-xy[i].first && pq[p].second==xy[j].second-xy[i].second) tmp++;
            }
        }
        ans=max(ans, tmp);
    }
    cout << N-ans << endl;
    
    return 0;
}

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

int main(){

  int i;
  double x,sum,v1,v2,a[100];

  while(cin >> a[0]){

    sum = 0;

    for(i=1;i<9;i++) scanf(",%lf",&a[i]);
    scanf(",%lf,%lf,%lf",&a[9],&v1,&v2);

    for(i=0;i<10;i++) sum += a[i];
 
    x = sum/(v1+v2);

    sum = v1 * x;

    for(i=0;i<10;i++){
      if(sum - a[i] > 0) sum -= a[i];
      else{
	cout << i+1 << endl;
	break;
      }
    }

  }
}

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    int x,a;
    scanf("%d%d",&x,&a);
    if(x<a){
        printf("0");
    }else{
        puts("10");
    }
    
    return 0;
}

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

using namespace std;

int main() {

	bool tol[105] = {false};

	int n, m, x, count1 = 0, count2 = 0;

	scanf("%d %d %d", &n, &m, &x);

	for(int i = 0; i < m; i++) {
		int index;
		scanf("%d", &index);

		tol[index] = true;
	}

	for(int i = x; i <= n; i++) {
		if(tol[i]) count1++;
	}

	for(int i = x; i > 0; i--) {
		if(tol[i]) count2++;
	}

	if(count1 < count2) {
		printf("%d\n", count1);
	} else {
		printf("%d\n", count2);
	}

	return 0;
}

Measured memory_bytes: 256
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
// https://atcoder.jp/contests/abc168/tasks/abc168_a
string ans[3] = {"hon","pon","bon"};
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

	ll n;
	cin >> n;
	ll val = n % 10;
	switch(val){
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			cout << ans[0] << "\n";
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			cout << ans[1] << "\n";
			break;
		case 3:
			cout << ans[2] << "\n";
			break;
		default:
			break;
	}

    return 0;
}

Measured memory_bytes: 3632
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = LI()
    d = collections.defaultdict(int)
    for c in a:
        d[c] += 1
    t = sorted(list(d.keys()))
    if t[-1] - t[0] > 1:
        return 'No'
    if len(t) == 1:
        if t[0] == n - 1:
            return 'Yes'
        if t[0] > n / 2.0:
            return 'No'
        return 'Yes'
    b = t[1] - d[t[0]]
    n2 = d[t[1]]
    if n2 == 2 and b == n2 - 1:
        return 'Yes'
    if b < 1:
        return 'No'
    if b >= n2 - 2:
        return 'No'
    if b > n2 / 2.0:
        return 'No'

    return 'Yes'


print(main())


Measured memory_bytes: 20484
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
l = [i for i in range(n + 1)]
b = set(l[:x]) & set(a)
c = set(l[x + 1:]) & set(a)
print(min(len(list(b)), len(list(c))))

Measured memory_bytes: 3060
n = int(input())
weights = [int(_) for _ in input().split()]
total = 0
for weight in weights:
    total += weight
    
diff = 10000000000
if n == 2:
    print(abs(weights[0]-weights[1]))
else:
    for i in range(n):
        s1 = 0
        for j in range(i):
            s1 += weights[j]
        s2 = total - s1
        if abs(s1 - s2) < diff:
            diff = abs(s1 - s2)
    print(diff)
            

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

long long gcd(long long a, long long b){
    if(a < b){
        swap(a, b);
    }

    long long r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

long long lcm(long long a, long long b){
    if(a > b){
        a /= gcd(a, b);
    }else{
        b /= gcd(a, b);
    }

    return a * b;
}

int main(){
    int n;
    cin >> n;
    vector<long long> l(n);
    for (auto i = 0; i < n; i++)
    {
        long long l_i;
        cin >> l_i;
        l[i] = l_i;
    }

    if(n == 1){
        cout << l[0] << endl;
        return 0;
    }

    long long ans = l[0];

    for (auto i = 1; i < n; i++)
    {
        ans = lcm(ans, l[i]);
    }

    cout << ans << endl;
}

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

const int MOD = 1000000007;
const int64_t INF = 1LL << 60;

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

    int start, end;

    rep(i, s.size())
    {
        if (s.at(i) == 'A') {
            start = i;
            break;
        }
    }
    for (int i = s.size() - 1; i >= 0; i--) {
        if (s.at(i) == 'Z') {
            end = i;
            break;
        }
    }

    cout << end - start + 1 << endl;
}


Measured memory_bytes: 640
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 ll INF=1e18;

int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> a(n),b(m),sa(n+1),sb(m+1);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        sa[i+1]=sa[i]+a[i];
    }
    rep(i,m){
        cin >> b[i];
    }
    rep(i,m){
        sb[i+1]=sb[i]+b[i];
    }
    ll le=-1,ri=n+m+1;
    while(ri-le>1){
        ll mid=(ri+le)/2;
        bool ok=false;
        for(ll i=0;i<=mid;i++){
            if(i<=n && mid-i<=m){
                if(sa[i]+sb[mid-i]<=k){
                    ok=true;
                    break;
                }
            }
        }
        if(ok) le=mid;
        else ri=mid;
    }
    cout << le << endl;
}

Measured memory_bytes: 9596
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    int A,B,C; cin>>A>>B>>C;
    cout<<C<<" "<<A<<" "<<B<<endl;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad

judge :: [Int] -> Int
judge xs =
  let k = head xs
      p = last xs
  in
      if k > p then
        if k `mod` p == 0 then
          p
        else
          k `mod` p
      else
        k

solver :: [[Int]] -> [Int]
solver = map judge

main :: IO()
main = do
  n <- (read :: String -> Int) <$> getLine
  inputs <- map (map (read :: String -> Int) . words) <$> replicateM n getLine
  mapM_ print $ solver inputs

Measured memory_bytes: 4112
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

type Tree struct {
	key   int
	left  *Tree
	right *Tree
}

func insert(t *Tree, n int) *Tree {
	if t == nil {
		return &Tree{key: n}
	}

	if n < t.key {
		t.left = insert(t.left, n)
	} else {
		t.right = insert(t.right, n)
	}
	return t
}

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }
	w := bufio.NewWriter(os.Stdout)

	m := nextInt()
	var t *Tree

	for i := 0; i < m; i++ {
		switch scn.Scan(); scn.Text() {
		case "insert":
			t = insert(t, nextInt())
		case "print":
			inorder(w, t)
			fmt.Fprintln(w)
			preorder(w, t)
			fmt.Fprintln(w)
		}
	}

	w.Flush()
}

func preorder(w io.Writer, t *Tree) {
	if t == nil {
		return
	}
	print(w, t.key)
	preorder(w, t.left)
	preorder(w, t.right)
}

func inorder(w io.Writer, t *Tree) {
	if t == nil {
		return
	}
	inorder(w, t.left)
	print(w, t.key)
	inorder(w, t.right)
}

func print(w io.Writer, n int) {
	fmt.Fprintf(w, " %d", n)
}



Measured memory_bytes: 24600
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    for (auto e: v) os << e << ",";
    os << "]";
    return os;
}

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

// print floating-point number
// cout << fixed << setprecision(12) <<

// }}}

int N, K;
ll h[200010];

void solve()
{
    ll ans = 0;
    sort(h, h+N);
    REP (i, N-K) ans += h[i];
    cout << ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP (i, N) cin >> h[i];
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(void){
  
  int x, A, B;		cin >> x >> A >> B;
  int ans1 = abs(x - A), ans2 = abs(x - B);
  if(ans1 < ans2)	cout << 'A' << endl;
  else cout << 'B' << endl;
  
  return 0;
}


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

using namespace std;

int main() {
	int t = 1; 
	//cin>>t;
	while (t--) {
		string s, t;
		cin>>s>>t;
		int len_s = s.length(), len_t = t.length();
		int answer = 0;
		if (len_s == len_t) {
			for (int i = 0; i < len_s; i++) {
				if (s[i] != t[i]) answer++ ;
			}
			cout<<answer;
			return 0;
		}
		for (int i = 0; i < len_s - len_t; i++) {
			int count = 0;
			for (int j = 0; j < len_t; j++) {
				if (s[i + j] == t[j]) count++;
			}
			answer = max(answer, count);
		}
		cout<<len_t-answer;
	}
}

Measured memory_bytes: 3580
input = readlines()

cities = {}
rates = {}
n = input.shift.chomp.to_i
input.each_with_index do |l, i|
  city, rate = l.chomp.split("\s")
  rate = rate.to_i
  cities[city] = [] if cities[city].nil?
  cities[city].push(i + 1)
  rates[i + 1] = rate
end

cities.keys.sort.each do |city|
  tmp = []
  list = cities[city].sort_by{|x| rates[x]}
  puts list.reverse().join("\n")
end


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

using namespace std;

int main()
{
	int n;
	string s;
	cin >> n >> s;
	int m1[26]{}, m2[26]{};
	for (auto&& c : s) m2[c-'a']++;
	int maxnum = 0, num = 0;
	for (auto&& c : s)
	{
		int j = c - 'a';
		m1[j]++;
		m2[j]--;
		if (m1[j] == 1) num++;
		if (m2[j] == 0) num--;
		maxnum = max(maxnum, num);
	}
	cout << maxnum << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);

    a = a*b;
    c = c*d;

    if(a>=c){
        printf("%d\n", a);
    }
    else{
        printf("%d\n", c);
    }


    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <vector>
#include <deque>
#include <algorithm>
#include <climits>

using namespace std;

int main() {
    int l;
    cin >> l;
    deque<int> a(l);
    for (int i = 0; i < l; i++) {
        cin >> a[i];
    }

    while (a.size() && a.front() == 0) a.pop_front();
    while (a.size() && a.back() == 0) a.pop_back();
    if (a.size() == 0) {
        cout << 0;
        return 0;
    }

    int n = a.size();

    long long dp[200005][5];
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j < 5; j++) {
            dp[i][j] = 1e18;
        }
    }

    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 5; j++) {
            long long val = dp[i][j];
            if (val >= (long long)1e18) continue;
            if (j == 0) {
                dp[i + 1][0] = min(dp[i + 1][0], val + a[i]);
            }
            else {
                dp[i + 1][4] = min(dp[i + 1][4], val + a[i]);
            }

            if (j <= 2) {
                dp[i + 1][2] = min(dp[i + 1][2], val + (a[i] % 2 == 0));
            }

            if (j <= 1) {
                dp[i + 1][1] = min(dp[i + 1][1], val + (a[i] == 0 ? 2 : (a[i] & 1)));
            }
            else if (j <= 3) {
                dp[i + 1][3] = min(dp[i + 1][3], val + (a[i] == 0 ? 2 : (a[i] & 1)));
            }
        }
    }

    long long ans = dp[n][0];
    for (int i = 0; i < 5; i++) ans = min(ans, dp[n][i]);
    cout << ans;
}

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

int main() {
	// your code goes here
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max({a*c,a*d,b*c,b*d})<<"\n";
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  
  if(S.at(0) == S.at(1) && S.at(2) == S.at(1)){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
from collections import deque
n = int(input())
g = [[] for _ in range(n)]
ln = []

for _ in range(n - 1):
    a, b, l = map(int, input().split())
    a, b = a - 1, b - 1
    g[a].append(b)
    g[b].append(a)
    ln.append((a, b, l))

q = deque([0])
par = [0] * n
order = []

while q:
    x = q.pop()
    order.append(x)
    for y in g[x]:
        if y == par[x]:
            continue
        par[y] = x
        q.append(y)

chr_l = [0] * n
for a, b, l in ln:
    if par[a] == b:
        chr_l[a] = l
    else:
        chr_l[b] = l

#print(ln, g, order)
#print(chr_l)

color = [-1] * n
color[0] = 0
org = [0, 1]

for x in order:
    for y in g[x]:
        if y == par[x]:
            continue
        if chr_l[y] % 2 == 0:
            color[y] = color[x]
        else:
            color[y] = color[x] ^ 1
print("\n".join(map(str, color)))


Measured memory_bytes: 91424
#include <bits/stdc++.h>
            #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(int i = m;i < n;i++)
            #define FORR(i, m, n) for(int i = m;i >= n;i--)
            #define SORT(v, n) sort(v, v+n);
            #define VSORT(v) sort(v.begin(), v.end());
            #define llong long long
            #define pb(a) push_back(a)
            #define INF 1000000000000000000LL
            #define MOD 1000000007
            using namespace std;
            typedef pair<int, int> P;
            typedef pair<llong, llong> LP;
            typedef pair<int, P> PP;
            typedef pair<llong, LP> LPP;
            //vector<tuple<long long, long long, long long>>vec;

            template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
            template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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


            int main()
            {
                int a, b;
                double t;
                cin >> a >> b >> t;
                t = t + 0.5;
                int v = t / a;
                cout << v * b << endl;
            }



Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main()
{
    char s[20];
    scanf("%s",s);
    if(s[0]=='S')
    {
        printf("Cloudy");
        return 0;
    }
    if(s[0]=='C')
    {
        printf("Rainy");
        return 0;
    }
    if(s[0]=='R')
    {
        printf("Sunny");
        return 0;
    }
    return 0;
}

Measured memory_bytes: 128
use std::collections::*;
use std::io::*;
use std::*;
// template {{{
macro_rules! get {
    ($($t:tt),*; $n:expr) => {
        {
            let stdin = std::io::stdin();
            let ret = std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
                let line = line.unwrap();
                let mut it = line.split_whitespace();
                _get!(it; $($t),*)
            }).collect::<Vec<_>>();
            ret
        }
    };
    ($($t:tt),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut it = line.split_whitespace();
            _get!(it; $($t),*)
        }
    };
}
macro_rules! _get {
    ($it:ident; [char]) => {
        _get!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        _get!($it; String).bytes().collect::<Vec<_>>()
    };
    ($it:ident; usize1) => {
        $it.next().unwrap().parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap().parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_get!($it; $t)),*)
    };
}
// }}}

fn primes(n: usize) -> Vec<i64> {
    let mut isprime = vec![true; n + 1];
    for i in 2..=n {
        let mut idx = 2 * i;
        while idx < n + 1 {
            isprime[idx as usize] = false;
            idx += i;
        }
    }
    let mut ret = Vec::new();
    for i in 2..=n {
        if isprime[i] {
            ret.push(i as i64);
        }
    }
    ret
}

fn main() {
    let n = get!(usize);
    let a = get!([i64]);
    let p = primes(1010);
    let mut count = vec![0; 1020];
    let mut bigpmap: HashMap<i64, u32> = HashMap::new();
    let mut ispair = true;
    let mut isset = true;
    for i in a {
        let mut ai = i;
        for j in p.iter() {
            if *j > ai {
                break;
            }
            if ai % j == 0 {
                count[*j as usize] += 1;
                while ai % j == 0 {
                    ai /= j;
                }
            }
        }
        if ai != 1 {
            *bigpmap.entry(ai).or_insert(0) += 1;
        }
    }
    for i in count {
        if i > 1 {
            ispair = false;
        }
        if i >= n {
            isset = false;
        }
    }
    for i in bigpmap {
        if i.1 as usize > 1 {
            ispair = false;
        }
        if i.1 as usize >= n {
            isset = false;
        }
    }
    println!(
        "{}",
        if ispair {
            "pairwise coprime"
        } else if isset {
            "setwise coprime"
        } else {
            "not coprime"
        }
    );
}


Measured memory_bytes: 17764
def read():
    n = int(input().strip())
    d = list(map(int, input().strip().split()))
    return n, d


def solve(n, d):
    d = sorted(d)
    median = n//2
    return d[median] - d[median-1]


if __name__ == '__main__':
    inputs = read()
    print('%d' % solve(*inputs))


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

int n;
vector<bool> visited(200, false);
vector<int> d(200, 1);
vector<vector<bool>> edge(200, vector<bool>(200, false));
vector<vector<bool>> used(200, vector<bool>(200, false));

bool flag;

int main(){
    cin >> n;
    char x;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            cin >> x;
            if (x == '1') {
                edge[i][j] = true;
            }
        }
    }
    int ans = - 1;
    int max_depth;
    int u;
    queue<int> q;
    for (int p = 0; p < n; p++){
        flag = true;
        q.push(p);
        visited[p] = true;
        while (q.size()){
            u = q.front(); q.pop();
            for (int i = 0; i < n; i++){
                if (!edge[u][i]) continue;
                if (used[u][i] || used[i][u]) continue;
                if (visited[i] && d[i] != d[u] + 1) flag = false;
                if (!flag) {
                    while (q.size()) q.pop();
                    break;
                }
                used[u][i] = true;
                visited[i] = true;
                d[i] = d[u] + 1;
                q.push(i);
            }
        }

        if (flag){
            ans = max(ans, *max_element(d.begin(), d.end()));
        }

        for (int i = 0; i < n; i++) d[i] = 1, visited[i] = false;
        for (int i = 0; i < n; i++){
            for (int j = 0; j < n; j++) used[i][j] = false;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
# import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()
    l = len(s)
    lh = (l - 1) // 2

    for i in range(lh):
        if s[i] != s[-1 - i]:
            print('No')
            sys.exit()

    s1 = s[0:(l - 1) // 2]
    s2 = s[(l + 1) // 2:]

    lhh = len(s1) // 2

    for i in range(lhh):
        if s1[i] != s[-1 - i]:
            print('No')
            sys.exit()
        if s2[i] != s[-1 -i]:
            print('No')
            sys.exit()

    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
import java.util.*;
    class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        int m = 0;
        int c = 0;
        for(int i=100;i>=1;i--){
            if(0==a%i&&0==b%i){
                m++;
                if(m==k){
                    System.out.println(i);
                }
            }
        }
    }
}

Measured memory_bytes: 21844
# 税抜価格から税込価格を計算する関数
#
#  [引数]
#   zeinuki  : 税抜価格(整数)
#   zeiritsu : 税率(パーセント, 整数)
#  [返り値]
#   税込価格(整数)
def calcZeikomi(zeinuki, zeiritsu):
    return zeinuki + zeinuki * zeiritsu // 100

# 税込価格から税抜価格の最小値を探索する関数
#
# [考え方]
#  税抜価格の最小値は1から税込価格の間にあり、1から探索すれば最小値が求まる
# [引数]
#  zeikomi  : 税込価格(整数)
#  zeiritsu : 税率(パーセント, 整数)
# [返り値]
#  税抜価格の最小値(整数)。存在しない場合はNone。
def calcZeinukiMinimum(zeikomi, zeiritsu):
    for i in range(1, zeikomi + 1):
        if (calcZeikomi(i, zeiritsu) == zeikomi):
            return i
    return None

# 税込価格から税抜価格の最大値を探索する関数
#
# [考え方]
#  税抜価格の最大値は1から税込価格の間にあり、税込価格から探索すれば最大値が
#  求まる
# [引数]
#  zeikomi  : 税込価格(整数)
#  zeiritsu : 税率(パーセント, 整数)
# [返り値]
#  税抜価格の最大値(整数)。存在しない場合はNone。
def calcZeinukiMaximum(zeikomi, zeiritsu):
    for i in range(zeikomi, 0, -1):
        if (calcZeikomi(i, zeiritsu) == zeikomi):
            return i
    return None

# 改定価格の最大値を計算する関数
#
# [引数]
#  rate0  : 変更前の消費税率(整数)
#  rate1  : 変更後の消費税率(整数)
#  price0 : 消費税率変更前の価格(整数)
# [返り値]
#  消費税率変更後の価格(整数)。存在しなければNone。
def calcKaiteiMaximum(rate0, rate1, price0):
    zeinuki = calcZeinukiMaximum(price0, rate0)
    if (zeinuki == None):
        return None
    return calcZeikomi(zeinuki, rate1)

# 問題を解く関数
#
# [考え方]
#  2商品の合計価格が与えられるので、総当たり法を実施
# [引数]
#  x : 変更前の消費税率(パーセント, 整数)
#  y : 変更後の消費税率(パーセント, 整数)
#  s : 消費税率変更前の２商品の税込合計価格
def solve(x, y, s):
    res = 0
    for i in range(1, s):
        price1 = calcKaiteiMaximum(x, y, i)
        price2 = calcKaiteiMaximum(x, y, s - i)
        if (price1 == None or price2 == None):
            continue
        res = max(res, price1 + price2)
    return res

# メインルーチン
while (True):
    ary = input().split()
    x = int(ary[0])
    y = int(ary[1])
    s = int(ary[2])
    if (x == 0 and y == 0 and s == 0):
        break
    print(solve(x, y, s))


Measured memory_bytes: 5604
import sys
import math
input = sys.stdin.readline

# int = int(input())
# s = input().split()
# i = list(map(int, input().split()))
# s = [input() for i in range(3)]

a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))

b1 = [a1[0], a2[0], a3[0]]
b2 = [a1[1], a2[1], a3[1]]
b3 = [a1[2], a2[2], a3[2]]

c1 = [a1[0], a2[1], a3[2]]
c2 = [a1[2], a2[1], a3[0]]

n = int(input())
s = [int(input()) for i in range(n)]

ca1 = 0
ca2 = 0
ca3 = 0
cb1 = 0
cb2 = 0
cb3 = 0
cc1 = 0
cc2 = 0
for x in s:
    if x in a1:
        ca1+=1
    if x in a2:
        ca2+=1
    if x in a3:
        ca3+=1
    if x in b1:
        cb1+=1
    if x in b2:
        cb2+=1
    if x in b3:
        cb3+=1
    if x in c1:
        cc1+=1
    if x in c2:
        cc2+=1

if ca1 == 3:
    print("Yes")
elif ca2 == 3:
    print("Yes")
elif ca3 == 3:
    print("Yes")
elif cb1 == 3:
    print("Yes")
elif cb2 == 3:
    print("Yes")
elif cb3 == 3:
    print("Yes")
elif cc1 == 3:
    print("Yes")
elif cc2 == 3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3192
#include <iostream>
using namespace std;
int main()
{
	string S;
	cin >> S;
	int renzoku = 0;

	if (S[0] == 'R')
	{
		renzoku ++;

		if (S[1] == 'R')
		{
			renzoku ++;

			if (S[2] == 'R')
			{
				renzoku++;
			}
		}
	}else if (S[1] == 'R')
	{
		renzoku++;

		if (S[2] == 'R')
		{
			renzoku++;
		}
	}
	else if (S[2] == 'R')
	{
		renzoku++;
	}
	cout << renzoku;
}

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

int main(){
	int A, B, C, X; 
	int counter = 0;
	cin >> A >> B >> C >> X;

	for (int a=0; a<=A; a++) {
		for (int b=0; b<=B; b++) {
			for (int c=0; c<=C; c++) {
				if (500*a + 100*b + 50*c == X) counter++;
			}
		}
	}
	cout << counter << endl;
}

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

      String n = sc.nextLine();

      if(n.equals("a")||n.equals("i")||n.equals("u")||n.equals("e")||n.equals("o")){
        System.out.println("vowel");
      }else{
        System.out.println("consonant");
      }

  }
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <math.h>

int main(void){
 int X=0,Y=0,Z1=0,Z2=0,Z=0;
 scanf("%d %d",&X,&Y);
 if(X==3){Z1=100000;}else if(X==2){Z1=200000;}else if(X==1){Z1=300000;}
 if(Y==3){Z2=100000;}else if(Y==2){Z2=200000;}else if(Y==1){Z2=300000;}
 if(X==1&&Y==1){Z=Z+400000;}
 printf("%d\n",Z+Z1+Z2);
 return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#define rep(i, n)for(int i=0; i<n; i++)
using ll = long long int;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];

    int ans=0;
    rep(i, n){
        for(int j=i+1; j<n; j++){
            for(int k=j+1; k<n; k++){
                if(l[i]!=l[j] && l[j]!=l[k] && l[k]!=l[i]){
                    if(l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[k]+l[i]>l[j]) ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <queue>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, n, m, now, ans = 0, t, a;
  scanf("%lld%lld", &n, &m);
  priority_queue<ll, vector<ll>, greater<ll> > p;
  for(i = 0; i < n; ++i) scanf("%lld", &a), p.push(a);
  pair<ll, ll> b[m];
  for(i = 0; i < m; ++i) scanf("%lld%lld", &b[i].second, &b[i].first);
  sort(b, b + m, greater< pair<ll, ll> >());
  for(i = 0; i < m; ++i) {
    for(j = 0; j < b[i].second && p.size(); ++j) {
      if(p.top() > b[i].first) break;
      p.pop(), ans += b[i].first;
    }
  }
  while(p.size()) ans += p.top(), p.pop();
  printf("%lld", ans);
  return 0;
}

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

typedef long long ll;

int main() {
    vector<ll> A(3);
    rep(i, 3) cin >> A[i];
    rep(i, 3) {
        if (A[i] % 2 == 0) {
            cout << "0\n";
            return 0;
        }
    }
    sort(A.begin(), A.end());
    cout << A[0] * A[1] << "\n";
}

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

#define f first
#define s second
#define pb push_back

using namespace std;

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

const ll N = 1e5 + 3;

ll n, m, p[N], len[N];
pll a[N];
vector<ll> res;
set<ll> s;

void make_set(ll v) {
	p[v] = v;
	len[v] = 1;
}

ll find_set(ll v) {
	if (p[v] == v) return v;
	return p[v] = find_set(p[v]);
}

ll union_sets(ll u, ll v) {
	u = find_set(u);
	v = find_set(v);
	ll r = 0;

	if (u != v) {		
		r = len[u] * len[v];
		p[v] = u;
		len[u] += len[v];
	}
	
	return r;
}

int main() {
	cin >> n >> m;
	for (ll i = 1; i <= m; ++i) cin >> a[i].f >> a[i].s;

	res.pb(n * (n - 1) / 2);
	for (ll i = m; i > 1; --i) {
		ll u = a[i].f, v = a[i].s;
		if (!s.count(u)) make_set(u);
		if (!s.count(v)) make_set(v);
		s.insert(u); s.insert(v);
		res.pb(res.back() - union_sets(u, v));
	}
	
	reverse(res.begin(), res.end());
	for (auto& v: res) cout << v << endl;
	
	return 0;
}


Measured memory_bytes: 9972
#include <cstdio>
using namespace std;

int n;
long long x, r;
long long gcd(long long a, long long b) {
	return b == 0 ? a : gcd(b, a % b);
}
int main(void) {
	scanf("%d%lld", &n, &x);
	r = x;
	for (int i = 1; i < n; i++) {
		scanf("%lld", &x);
		r = r / gcd(r, x) * x;
	}
	printf("%lld\n", r);
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var dx = ReadInts();
            var ans = 0;
            for (int i1 = 0; i1 < n; i1++)
            {
                var a = ReadInt();
                var tmp = 0;
                for (int i = 1; i <= dx[0]; i+=a)
                {
                    tmp++;
                }
                ans += tmp;
            }
            
            WriteLine(ans+dx[1]);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <climits>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <tuple>
#include <queue>
#include <deque>
#include <unordered_set>
#include <unordered_map>

typedef long long ll;
using namespace std;

int main(void) {
  int N; cin >> N;
  set<int> S;
  int count = 0;
  for (int i = 0; i < N; i++) {
    int tmp; cin >> tmp;
    if (tmp < 3200)
      S.insert(tmp / 400);
    else
      count++;
  }

  int count_min = max(1, (int)S.size());
  int count_max = S.size() + count;
  cout << count_min << " " << count_max << endl;
}


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


using namespace std;

using ll   = long long;
using ii   = pair < int , int >;
using i3   = pair < int , ii >;
using li   = pair < ll , int >;
using lii  = pair <  ll,  ii >;
using vi   = vector < int >;
using vl   = vector < ll >;
using vli  = vector < li >;
using vii  = vector < ii >;
using vi3  = vector < i3 >;
using vlii = vector < lii >;

const int N = 1e5 + 5;
const ll INF = 1e17;
const double eps = 1e-12 , PI = acos(-1);

int n , m;


void A(){
    scanf("%d %d" , &n , &m);

    printf("%d\n" , n <= 9 && m <= 9 ? n*m : -1);
}

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

    for(int i = 1 ; i*i <= n ; i ++){
            if(n%i == 0){
                    if(i <= 9 && n/i <= 9){
                            printf("Yes\n");
                            return;
                    }
            }
    }
    printf("No\n");
}

void C(){
    ll x;
    scanf("%lld" , &x);

    ll ans = INF;
    for(ll i = 1ll ; i*i <= x ; i ++){
            if(x%i == 0){
                    ans = min(ans , i + x/i);
            }
    }

    printf("%lld\n" , ans - (1ll * 2));
}

main(){

    //A();
    B();
    //C();

    return 0;
}


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

using namespace std;

char field[101][101];
bool passed[101][101];

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

int h,w;
// ×ÚÇÀWÌXg
set<pair<int,int> > walls;
set<pair<int,int> > spList;


bool bfs(int sx,int sy,bool w){
	// Ü¸ÊÉbfs
	queue<pair<int,int> > *prv=new queue<pair<int,int> >();
	queue<pair<int,int> > *nxt=new queue<pair<int,int> >();
	
	prv->push(make_pair(sy,sx));
	bool fin=false;
	passed[sy][sx]=true;
	while(prv->size()){
		while(prv->size()){
			pair<int,int> p = prv->front();
			prv->pop();
			// ÇÉBµ½çAI¹
			if(p.first==0||p.first==h-1||p.second==0||p.second==w-1){
				return true;
			}
			// lûüÉÚ®
			for(int i = 0; i < 4; i++){
				int nx=p.second+dx[i];
				int ny=p.first+dy[i];
				if(!passed[ny][nx]){
					if(w){
						if(field[ny][nx]=='.'){
							nxt->push(make_pair(ny,nx));
							passed[ny][nx]=true;
						}
						else if(field[ny][nx]=='#'){
							walls.insert(make_pair(ny,nx));
						}
					}
					else{
						if(field[ny][nx]=='#'){
							nxt->push(make_pair(ny,nx));
							passed[ny][nx]=true;
						}
						else if(field[ny][nx]='.'){
							spList.insert(make_pair(ny,nx));
						}
					}
				}
			}
		}
		swap(prv,nxt);
	}
	return false;
}

int main(){

	// ÇÉÕË·éÜÅbfsðJè©¦·
	while(cin>>w>>h&&!(w==0&&h==0)){
		walls.clear();
		spList.clear();
		int sx,sy;
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				cin>>field[i][j];
				if(field[i][j]=='&')
					sx=j,sy=i;
			}
			fill(passed[i],passed[i]+w,false);
		}
		int cnt=0;
		bool fin=false;
		spList.insert(make_pair(sy,sx));
		while(1){
			// ÇÀWÌXgªèÉüéÌÅA»ÌÇÀW©çBÅ«éêðTõ
			for(set<pair<int,int> >::iterator it = spList.begin(); it != spList.end(); it++){
				int cx=it->second;
				int cy=it->first;
				if(bfs(cx,cy,true)){
					fin=true;
					break;
				}
			}
			if(fin)
				break;
			spList.clear();
			cnt++;
			// ÇðÂ½ÁÄ¢¯éªðTõµA»ÌãÇÉ×Ú·éÀWðÛµÄ¨«A[v
			for(set<pair<int,int> >::iterator it = walls.begin(); it != walls.end(); it++){
				int cx=it->second;
				int cy=it->first;
				if(bfs(cx,cy,false)){
					fin=true;
					break;
				}
			}
			if(fin)
				break;
			walls.clear();
		}
		cout<<cnt<<endl;
	}

	return 0;
}

Measured memory_bytes: 25000
using System;
public class Program
{
    public static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split();

        var d = int.Parse(input[0]);
        var t = int.Parse(input[1]);
        var s = int.Parse(input[2]);

        var ans = t * s >= d ? "Yes" : "No";

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 27468