akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a , b , c , d;
    cin >> a >> b >> c >> d;
    double p1 = (double)a/(double)d;
    double p2 = (double)c/(double)b;
    int p11 = ceil(p1);
    int p22 = ceil(p2);
    if(p11 >= p22)cout << "Yes"<<endl;
    else cout << "No" <<endl;
}


Measured memory_bytes: 3560
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int h = sc.nextInt();
            int w = sc.nextInt();
            if(h == 0 && w == 0){
                break;
            }
            
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


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

int main(){
    int n, i, c, p = -1;
    int a[200001] = {};
    cin >> n;
    long long r[n+1] = {};
    r[0] = 1;
    for(i=1; i<=n; i++){
        cin >> c;
        if(a[c] == 0){
            a[c] = i;
            r[i] = r[i-1];
        }else{
            if(i-a[c] == 1){
                a[c] = i;
                r[i] = r[i-1];
            }else{
                r[i] = r[i-1] + r[a[c]];
                a[c] = i;
            }
        }
        r[i] %= 1000000007;
    }
    cout << r[n];
    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), X = sc.nextInt();
		int m[] = new int[N];
		int sum = 0;
		int min = 1001;
		for (int i = 0; i < N; i++) {
			m[i] = sc.nextInt();
			sum += m[i];
			min = Math.min(min, m[i]);
		}
		sc.close();
		int a = X - sum;
		int ans = N;
		for (int i = 0; i <= a; i += min) {
			ans++;
		}
		System.out.println(ans-1);
	}
}


Measured memory_bytes: 22100
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << "\n"; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve(){
  ll n,k;
  cin>>n>>k;
  vector<ll>h(n);
  rep(i,n)cin>>h[i];
  sort(h.rbegin(),h.rend());
  ll sum=0;
  for(int i=k;i<n;++i)
  sum+=h[i];
  cout<<sum<<endl;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 1792
import copy
n = int(input())
dish = []
for i in range(n):
    a,b = map(int,input().split())
    dish.append((a,b, a+b))
dish.sort(key=lambda x:x[2])
dish.reverse()
tk = dish[0:n:2]
ao = dish[1:n:2]
tkp = 0
aop = 0
for i in range(len(tk)):
    tkp += tk[i][0]
for i in range(len(ao)):
    aop += ao[i][1]
print(tkp-aop)






Measured memory_bytes: 22628
#include <bits/stdc++.h> 
using namespace std;
 
int main(){
  string S;
  cin >> S;
  int cnt = 0;
  int max_cnt = 0;
  int size = S.size();
  
  for(int i=0; i<size; i++){
    if(S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T'){
      cnt++;
    }else{
      cnt = 0;
    }
    if(cnt > max_cnt){
      max_cnt = cnt;
    }
  } 
  cout << max_cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846
#define ld long double

int main(){
    int h, w;
    cin>>h>>w;
    vector<vector<bool> > v(h, vector<bool>(w));
    int n = h*w;
    for(int i = 0; i<h; i++){
        for(int j = 0; j<w; j++){
            char c;
            cin>>c;
            if(c == '.')v[i][j] = true;
            else v[i][j] = false;
        }
    }
    vector<vector<int> > dist(n, vector<int> (n, INT_MAX));
    for(int i = 0; i<n; i++){
        dist[i][i] = 0;
    }
    for(int i = 0; i<n;i++){
        int row = i/w;
        int col = i%w;
        if(!v[row][col])continue;
        if(row > 0 && v[row-1][col]){
            dist[i][i-w] = 1;
        }
        if(row < h-1 && v[row + 1][col]){
            dist[i][i+w] = 1;
        }
        if(col > 0 && v[row][col-1]){
            dist[i][i-1] = 1;
        }
        if(col < w-1 && v[row][col+1]){
            dist[i][i+1] = 1;
        }
    }
    for(int k = 0; k<n; k++){
        for(int i = 0; i<n; i++){
            for(int j = 0;j<n; j++){
                if(dist[i][k] == INT_MAX || dist[k][j] == INT_MAX)continue;
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    int max1 = 1;
    for(int i = 0; i<n; i++){
        for(int j = 0; j<n; j++){
            if(dist[i][j] == INT_MAX)continue;
            max1 = max(max1, dist[i][j]);
        }
    }
    cout<<max1<<endl;
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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; }
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int k,s;
    cin >> k >> s;
    int c = 0;
    rep(x,k+1){
        rep(y,k+1){
            if (s-x-y >= 0 && s-x-y <= k) c++;
        }
    }
    PRINT(c);
}

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

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

    int ans = min(b/a, c);
    cout << ans << endl;
    return 0;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    ll n;
    cin >> n;
    cout << (n*(n-1)/2) << endl;
    return 0;
}


Measured memory_bytes: 3592
N = int(raw_input())
A = [int(raw_input()) - 1 for _ in range(N)]

ans = 0
i = 0
used = set([0, 1])
while True:
    if ans != 0 and i in used:
        break
    used.add(i)
    i = A[i]
    ans += 1
if i != 1:
    ans = -1
print ans


Measured memory_bytes: 14964
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}


int main(){
    int n,m;
    cin >> n >> m;
    vector<int> v(n,0);
    vector<bool> x(n,false);
    int ac=0;
    REP(i,m){
        int input1;
        string input2;
        cin >> input1 >> input2;
        if(input2=="WA"&&x[input1-1]!=true){
            v[input1-1]++;
        }
        else if(x[input1-1]!=true){
            x[input1-1]=true;
            ac++;
        }
        else{
            continue;
        }
    }
    int wa=0;
    REP(i,n){
        if(x[i]==true){
            wa+=v[i];
        }
    }
    cout << ac << " " << wa << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>

using namespace std; 

void swap(int *a, int *b){
	*b=*a-*b;
	*a-=*b;
	*b+=*a;
}

int sosu_judge(int N){
	/*素数ならば1
	  素数でなければ0を返す
	*/
	int i,j;

	if(N==2)   return 1;
	if(N%2==0) return 0;

	for(i=3;i<N && N%i!=0;i+=2);

	if(i>=N) return 1;
	
	return 0;
}

int factorial(int N){  //Nの階乗を求める関数
	int ans=1;

	while(N--) ans*=(N+1);
	return ans;
}

void q_sort(int a[], int first, int last){
    int i,j;
    int x,t;

    x = a[(first + last) / 2];
    i = first; j=last;

    while(1){
        while( a[i] < x) i++;
        while( x < a[j]) j--;
        
        if( i >= j) break;
        
        swap(&a[i],&a[j]);
        i++; j--;
    }
    if(first < i-1) q_sort(a, first,i-1 );
    if(last > j+1)  q_sort(a, j+1,  last);
}

int main(){
    int   N,A[100];
    float total=0;
    int   i,j,k;

    cin>>N;
    for(i=0;i<N;i++) cin>>A[i];

    for(i=0;i<N;i++){
        total+=1.0/(float)A[i];
    }

    printf("%5.5f\n",1.0/total);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define INF 1000000000
#define MOD 1000000007

void solve() {
    int n;
    cin >> n;
    vi a(n+1);
    rep(i,1,n+1) {
        cin >> a[i];
    }
    int ans = 1, i = 1;
    set<int> s{1};
    while (a[i] != 2) {
        i = a[i];
        if (i != 2 && s.find(i) != s.end()) {
            cout << -1;
            return;
        }
        s.emplace(i);
        ++ans;
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}



Measured memory_bytes: 8220
#include<stdio.h>
#define Max 100
int main(){
  int n,fib[Max],i;
 
  scanf("%d", &n);
  fib[0]=1;
  fib[1]=1;
  for(i = 2;i <= n;i++){
    fib[i]=fib[i-1]+fib[i-2];
}
  printf("%d\n", fib[n]);
 
  return 0;
}

Measured memory_bytes: 596
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    n = ii()
    ans = 0
    for i in range(1,n+1):
        if not i%3:
            continue
        if not i%5:
            continue
        ans+=i
    print(ans)

main()





Measured memory_bytes: 10024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

int N; ll A[55];

void solve(){
	scanf("%d", &N);
	for(int i=1;i<=N;i++) scanf("%lld", A+i);
	ll t = 0;
	for(int i=1;i<=N;i++) {
		t += A[i] / (N + 1);
	}
	for(int i=1;i<=N;i++) A[i] = A[i] % (N + 1) + t;
	ll r = max(0LL, *max_element(A+1, A+1+N) - 3 * N);
	t += r * N;
	for(int i=1;i<=N;i++) A[i] -= r;
	while(1) {
		int f = -1;
		for(int i=1;i<=N;i++) if(A[i] >= N) { f = i; break; }
		if(f == -1) break;
		A[f] -= N+1;
		for(int i=1;i<=N;i++) A[i]++; ++t;
	}
	printf("%lld\n", t);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

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

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//namespaces
using namespace __gnu_pbds; 
using namespace std;

//MACROS
#define ld long double
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long 
#define For(i,s,e) for (int i=(s); i<(e); i++)
#define Fod(i,s,e) for (int i=(s); i>=(e); i--)
#define pii pair<ll,ll>
#define f first
#define s second
#define endl "\n"
#define all(container) container.begin(), container.end()
#define mp make_pair
#define int ll

//debug
#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

//Templates
template <typename T>
using ordered_set =tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }

//globals
ll const prime1 = 304933;
ll const prime2 = 15486277;
ll const mod = 1e9+7;
ll const inf = 1e18;
ll const size_1d = 1e6 + 7;
ll const size_2d = 1e3 + 7;

//functions
ll power(ll x, ll y, ll mod = 2e18){ ll ans = 1;x %= mod;while(y){if(y&1)ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
ll modInverse(ll a, ll m){ll m0 = m;ll y = 0, x = 1;if (m == 1) return 0;while (a > 1){ ll q = a / m;ll t = m;m = a % m,a = t;t = y;y = x - q * y;x = t;}if(x < 0) x += m0;return x;} 
ll gcdext(ll a,ll b,ll *x = 0, ll *y = 0){if(a == 0){*x = 0;*y = 1;return b;}ll x1,y1;ll gcd1 = gcdext(b%a,a,&x1,&y1);*x = y1 - (b/a)*x1;*y = x1;return gcd1;}
int randomize(){return (rand()%10000);} 

// CODE STARTS HERE

signed main(){
    IOS
    ll a,b;cin >> a >> b;
    ll x,y;
    cout << a*b/(gcdext(a,b,&x,&y)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  int a,b,c;
  cin>>a>>b>>c; 
  bool ans=false;
  for(int i=a;i<10000;i+=a){
  if(i%b==c){
    ans=true;
    break;
  }
  }
  if(ans){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  
 
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
 
 
using namespace std;
 
 
 
int main()
    {
		ll t;
		t=1;
		//scanf("%lld",&t);
		while(t--)
		{
			string a,b;
			cin>>a>>b;
			cout<<b+a<<endl;
		}
	
	return 0;
	}
 



Measured memory_bytes: 256
#include <iostream>

int main(void) {
  int a = 0;
  int b = 0;
  std::cin >> a >> b;
  if (1 <= a && a <= 100 && 1 <= b && b <= 100) {
    std::cout << a*b << " ";
    std::cout << 2*(a+b) << "\n";
  }

  return 0;
}

Measured memory_bytes: 3048
a,b = input().split()
a = int(a)
b = int(b)
string = ""
if a>b:
    for i in range(a):
        string = string+str(b)
elif b>a:
    for i in range(b):
        string = string+str(a)
else:
    for i in range(a):
        string =  string+str(a)
print(string)

Measured memory_bytes: 3060
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	ll mny = 1000 ;
	ll cnt = 0 ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	a.push_back(0) ;
	for(int i=0;i<n;i++){
		mny += cnt*a.at(i) ;
		cnt = 0 ;
		if(a.at(i)<=a.at(i+1)){
			cnt += mny/a.at(i) ;
			mny %= a.at(i) ;
		}
	}
	cout << mny << endl ;
}


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

int main() {
  int K , N ;
  cin >> K >>N;
  
  vector<int> vec1(N);
  vector<int> vec2(N);
  
  for(int i=0;i<N;i++){
    cin>> vec1.at(i);
  }
    
  for(int i=0; i<N-1 ;i++){
    vec2.at(i)=vec1.at(i+1)-vec1.at(i);
  }
         

  vec2.at(N-1)=vec1.at(0)+(K-vec1.at(N-1));
    
  sort(vec2.begin(),vec2.end());
  
  int sum=0;
  for(int j=0;j<N-1 ; j++){
    sum+=vec2.at(j);
  }
  
  cout<< sum<< endl;








}
  

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

int main() {
 int K, A, B;
  cin >> K >> A >> B;
  bool aim = false;
  for (int i = A; i < B + 1; ++i){
    if( i % K == 0) aim = true;
  }
  if(aim) cout << "OK" << endl;
  else cout << "NG" << endl;
    

}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<ll> Size;
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n + 1); rank.resize(n + 1), Size.resize(n + 1);
        for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    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 (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

    ll size(int x){
        return Size[par[x]];
    }
};


int main() {
    //cout.precision(10);
    UnionFind uni(200010);
    UnionFind bi(200010);
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    ll one = 0;
    for(int i = 1; i <= m; i++){
        int u, v;
        cin >> u >> v;
        uni.merge(u, v);
        bi.merge(u + 100000, v);
        bi.merge(u, v + 100000);
    }
    ll roop = 0;
    ll simple = 0;
    for(int i = 1; i <= n; i++){
        if(uni.root(i) != i){
            continue;
        }
        if(uni.size(i) == 1){
            one++;
            continue;
        }
        if(bi.issame(i, i + 100000)){
            roop++;
        } else {
            simple++;
        }
        //cout << i << " " << uni.size(i) << " " << now << endl;
        //ans = ans - uni.size(i) * uni.size(i) + now;
    }
    ans += (roop + simple) * (roop + simple) + simple * simple;
    for(ll i = n - one + 1; i <= n; i++){
        ans += 2 * i - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6528
X,Y,A,B,C = map(int,input().split())
P = [int(x) for x in input().split()]
Q = [int(y) for y in input().split()]
R = [int(z) for z in input().split()]
P.sort(reverse = True)
Q.sort(reverse = True)
P = P[:X]
Q = Q[:Y]
apple = P + Q + R
apple.sort(reverse=True)
print(sum(apple[:X+Y]))

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

int selectionSort(int A[], int N) {
  int sw = 0;
  for ( int i = 0; i < N; i++ ) {
    int minj = i;
    for ( int j = i; j < N; j++ ) {
      if ( A[minj] > A[j] ) {
        minj = j;
      }
    }
    if ( minj != i) {
      swap(A[i], A[minj]);
      sw++;
    }
  }
  return sw;
}

int main() {
  int A[100], N, sw;

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

  sw = selectionSort(A, N);

  for ( int i = 0; i < N; i++ ) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;

  return 0;
}

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

int main(void) {
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f) {
        double y = ((d*c-a*f) / (double)(b*d-a*e));
        double x = (c - b*y) / (double)a;
        printf("%.3f %.3f\n", x, y);
    }
    return(0);
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cmath>
#include <stack>
#include <string>
#include <queue>
#include <unordered_map>
#include <limits>
//std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  ll N;
  std::cin >> N;

  std::vector<std::unordered_map<ll, ll>> t;
  t.resize(N);

  for(ll i=0; i<N-1; i++){
    ll u,v,w;
    std::cin >> u >> v >> w;
    t[u-1][v-1] = w;
    t[v-1][u-1] = w;
  }

  std::vector<int> memo(N, -1);
  std::stack<ll> q;
  memo[0] = 0;
  q.push(0);
  while(!q.empty()){
    ll cur = q.top(); q.pop();
    for(auto itr = t[cur].begin(); itr != t[cur].end(); ++itr){
      if ( memo[itr->first] != -1 ) continue;
      if ( itr->second % 2 == 0 ) memo[itr->first] = memo[cur];
      else memo[itr->first] = (memo[cur] == 0) ? 1 : 0 ;
      q.push(itr->first);
    }
  }

  for(int i=0; i<N; i++) std::cout << memo[i] << std::endl;

  return 0;
}

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

int  main()
{
	string  a,b;
	
	int  x;
	
	int  zh(string  s);
	
	cin>>a>>b;
    
    x=zh(a+b);
    
    if(int(sqrt(x))==sqrt(x))
       cout<<"Yes"<<endl;
    else
       cout<<"No"<<endl;
       
    return 0;
}

int  zh(string  s)
{
	int  t=0;
	
	for(int  i=0; i<s.size(); i++)
	   t=t*10+(s[i]-'0');
	   
	return  t;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
        String s = scan.next();
 
        int ans = 0;
        for (int i = 0; i < 4; i++) {
            if (s.charAt(i) == '+') {
                ans++;
            } else {
                ans--;
            }
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#入力高速化 + 再帰回数制限解除
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10000000)

#負の閉路検出
#n=頂点数 e=[[a,b,c],[]...](a~bの距離がc)
def find_negative_loop(n,e):
  d=n*[10**20];d[0]=0
  for h in range(n):
    for i,j,k in e:
      if d[j]>d[i]+k:
        d[j]=d[i]+k
        if h==n-1:return -1
  return max(-d[n-1],0)

#DAG判定
#n=頂点数 e=隣接リスト
#flag=0...DAG判定　flag=1...トポロジカルソート
from collections import deque
def find_loop(n,e,flag):
  x=[0]*n
  d=deque()
  t=[]
  c=0
  for i in range(n):
    for j in e[i]:x[j]+=1
  for i in range(n):
    if x[i]==0:
      d.append(i)
      t.append(i)
      c+=1
  while d:
    i=d.popleft()
    for j in e[i]:
      x[j]-=1
      if x[j]==0:
        d.append(j)
        t.append(j)
        c+=1
  if flag==0:return c==n
  else:return t

n,m,p=map(int,input().split())
ef=[[]for _ in range(n)]
ee=[[]for _ in range(n)]
edge=[[]for _ in range(n)]
e=[]
for _ in range(m):
  a,b,c=map(int,input().split())
  a-=1
  b-=1
  c-=p
  ef[a].append(b)
  ee[b].append(a)
  edge[a].append((b,c))
  e.append((a,b,c))
eff=[0]*n
eff[0]=1
Q=[0]
visited={0}
while Q:
  P=[]
  for i in Q:
    for j in ef[i]:
      if j in visited:continue
      visited.add(j)
      eff[j]=1
      P.append(j)
  Q=P
eef=[0]*n
eef[n-1]=1
Q=[n-1]
visited={n-1}
while Q:
  P=[]
  for i in Q:
    for j in ee[i]:
      if j in visited:continue
      visited.add(j)
      eef[j]=1
      P.append(j)
  Q=P
ee=[]
for a,b,c in e:
  if eff[a]==1 and eef[a]==1 and eff[b]==1 and eef[b]==1:
    ee.append((a,b,-c))
print(find_negative_loop(n,ee))

Measured memory_bytes: 6000
def drop(x,y):
    global paper
    if 0<=x<10 and 0<=y<10: paper[y][x]+=1
    return

def ink(x,y,size):
    drop(x,y)
    drop(x-1,y)
    drop(x+1,y)
    drop(x,y-1)
    drop(x,y+1)
    if size==1: return
    drop(x-1,y-1)
    drop(x-1,y+1)
    drop(x+1,y-1)
    drop(x+1,y+1)
    if size==2: return
    drop(x-2,y)
    drop(x+2,y)
    drop(x,y-2)
    drop(x,y+2)
    return

paper = [[0 for i in range(10)] for j in range(10)]
while True:
    try:
        x,y,size = map(int, raw_input().split(","))
        ink(x,y,size)
    except:
        break

print sum([e.count(0) for e in paper])
print max([max(e) for e in paper])

Measured memory_bytes: 4268
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

#define debug(x) cout << #x << ": " << x << endl;
#define ll long long
#define mod 1000000007

ll X, Y;

ll inv[2000010]; // ith index will store (1/i)%mod
ll finv[2000010]; // ith index will store (1/i!)%mod
ll fact[2000010]; // ith index will store (i!)%mod

void populate(int n) {
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;

    for(int i = 2;i <= n;i++) {
        fact[i] = (i*fact[i-1])%mod;
        inv[i] = mod-((inv[mod%i]*(mod/i))%mod);
        finv[i] = (finv[i-1]*inv[i])%mod;
    }
}

int main() {
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);

  cin >> X >> Y;
  // 2x + y = X
  // 2y + x = Y
  // 3y = (2Y-X)
  // 3x = (2X-Y)

  ll lhs = 2*Y-X, rhs = 2*X-Y;
  if(lhs < 0 || rhs < 0 || lhs%3 != 0 || rhs%3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  ll x = lhs/3;
  ll y = rhs/3;

  populate(x+y);

  cout << (fact[x+y]*((finv[x]*finv[y])%mod))%mod << endl;

  return 0;
}


Measured memory_bytes: 20864
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
using namespace std; 
int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
		b.at(i) = { a.at(i) };
	}
	int f = 0;

	for (int j = 0; j < 102; j++)
	{


		for (int i = 0; i < n; i++)
		{
			if (a.at(i) < j)
			{
				f = 1;
				cout << j - 1 << endl;
				break;
			}
			if (i == n - 1)
			{
				break;
			}
			else {
				int x = a.at(i) - j;
				a.at(i + 1) += x;
			}

		}
		for (int k = 0; k < n; k++)
		{
			a.at(k) = b.at(k);
		}
		if (f==1)
		{
			break;
		}

	}
}



Measured memory_bytes: 3128
#include<stdio.h>
int main()
{
   int f,a,k;
   scanf("%d %d",&f,&a);
   k= -32767;
   if(k<f+a)
   k=f+a;
   if(k<f-a)
   k=f-a;
   if(k<f*a)
   k=f*a;
   printf("%d\n",k);
   return 0;
}


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

int main()
{
	int q;
	scanf("%d", &q);
	unordered_set<int> st;
	while (q--) {
		int com, x;
		scanf("%d%d", &com, &x);
		if (com == 0) {
			st.insert(x);
			printf("%d\n", st.size());
		}
		else if (com == 1) {
			puts(st.count(x) ? "1" : "0");
		}
		else {
			st.erase(x);
		}
	}
	return 0;
}



Measured memory_bytes: 11060
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();

        int ans = 0;

        while (k > 0 && a > 0) {
            ans = ans + 1;
            k--;
            a--;
        }

        while (k > 0 && b > 0) {
            k--;
            b--;
        }

        while (k > 0 && c > 0) {
            ans = ans - 1;
            k--;
            c--;
        }

        System.out.println(ans);

    }
}


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

int main() {
  int k;
  cin >> k;
  if (k%2==0 || k%5==0) {
    cout << -1;
    return 0;
  }
  int ans = 1;
  int r = 7;
  while (ans <= k) {
    if (r%k == 0) {
      cout << ans;
      return 0;
    }
    r = (r * 10 + 7) % k;
    ans++;
  }
  cout << -1;
  return 0;
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
#define si(a) scanf("%d",&a)
#define fore(i,a,b) for(int i=a;i<b;++i)
#define sorte(a) sort(a.begin(), a.end())
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
bool mat[101][101];
int main(){
	int n,k;
	si(n);
	si(k);
	if(k > ((n*n-3*n+2)/2))
		printf("-1\n");
	else{
		fore(i,2,n+1) mat[1][i]=true;
		fore(i,2,n+1) mat[i][1]=true;
		int limi = ((n*n-3*n+2)/2);
		int edge = n-1;
		fore(i,2,n+1){
			if(limi==k)
				break;
			fore(j,i+1,n+1){
				if(limi==k)
					break;
				if(mat[i][j]==false){
					mat[i][j]=true;
					limi--;
					edge++;
				}
			}
		}
		printf("%d\n",edge);
		fore(i,1,n+1){
			fore(j,i+1,n+1){
				if(mat[i][j]){
					printf("%d %d\n",i,j);
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2019/04/20
 *      Author: family
 */

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

int main()
{
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
    if( A > B) {
        int b = B;
        B = A;
        A = b;
    } else {
    }

    if((A <= C) && (C <= B)) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define fo(i, n) for(int i = 1; i <= (n); i ++)
#define out(x) cerr << #x << " = " << x << "\n"
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); ++ it)
using namespace std;
#define SZ(x) ((int) (x).size())
#define mem(x, b) memset((x), b, sizeof (x))
typedef long long ll;
#define QAQ cerr << "233\n";
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
template<typename tp> inline void arr(tp *a, int n) {
  for(int i = 1; i <= n; i ++)
    cout << a[i] << " ";
  puts("");
}
const int N = 3e5 + 233;
int n, a[N], last[N], ans = 0, idx[N];

main(void) {
  read(n);
  for(int i = 1; i <= n; i ++)
    read(a[i]), idx[a[i]] = i;
  for(int l = 1; l <= n; l ++) {
    int r = l;
    while(r < n && idx[r] < idx[r + 1]) ++ r;
    ans = max(ans, r - l + 1);
    l = r;
  }
  cout << n - ans << "\n";
}


Measured memory_bytes: 6016
#include<bits/stdc++.h>
#define f first
#define s second
#define inf 999999999999
#define N  500009
#define M  (L+R)/2
#define ll long long
#define pb push_back
using namespace std;

ll n,k,sum;

int main()
{

	ios::sync_with_stdio(0);
	
	cin>>n>>k;
	
	n++;
	
	sum=n/2;
	
	if(sum<k)cout<<"NO"<<endl;
	else
	cout<<"YES"<<endl;
return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  int N;
  cin >> N;
  int A[N+1];
  
  int B;
  for(int i=0; i < N+1; i++){
    cin >> A[i];
  }
  long long ckill = 0;
  for(int i = 0; i < N; i++){
    cin >> B;
    if(A[i] >= B){
      ckill += B;
    } else {
      ckill += A[i];
      B -= A[i];
      if(A[i+1] <= B){
		ckill += A[i+1];
        A[i+1] = 0;
      } else {
        ckill += B;
        A[i+1] -= B;
      }   
  	}
  }
  cout << ckill << endl;
  
}

Measured memory_bytes: 640
// D.

#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int solve(vector<int> a) {
	sort(a.begin(), a.end());
	int n = (int)a.size();
	if (n == 1) {
		return a[0] % 2;
	}
	if (a.back() == 1) {
		return true;
	}
	bool e = true;
	for (int x : a) {
		if (x % 2) {
			e = false;
		}
	}
	return !e;
}

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	cout << (solve(a) ? "first" : "second") << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/

const int MOD=1000000007;/* 1,000,000,007 で割った余りを出力する　のとき使う*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int N;
int X;
int L[105];

int main(void) {
  cin >> N >> X;
  
  L[0]=0;
  for(int i=1; i<=N; i++){
    cin >> L[i];
  }
  
  int sum=0;
  int ans=0;
  for(int i=0; i<=N; i++){
    sum=sum+L[i];
    if(sum<=X){
      ans++;
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
public class Main{
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		double r=stdIn.nextDouble();
		double s=r*r*Math.PI;
		double l=2*r*Math.PI;
		System.out.println(BigDecimal.valueOf(s).toPlainString()+" "+BigDecimal.valueOf(l).toPlainString());
	}
}

Measured memory_bytes: 28244
n = int(input())
mod = 10**9 + 7
d = {}
cnt = 0
for i in 'ATGC':
  for j in 'ATGC':
    for k in 'ATGC':
      s = i+j+k
      d[s] = cnt
      cnt += 1
dp = [[0 for j in range(n-2)] for i in range(64)]
for i in 'ATGC':
  for j in 'ATGC':
    for k in 'ATGC':
      s = i+j+k
      if s!='AGC' and s!='ACG' and s!='GAC':
        dp[d[s]][0] = 1
for i in range(n-3):
  for x in 'ATGC':
    for y in 'ATGC':
      for z in 'ATGC':
        for w in 'ATGC':
          s = y+z+w
          if s!='AGC' and s!='ACG' and s!='GAC' and x+s!='AGAC' and x+s!='AGTC' and x+s!='AGGC' and x+s!='ATGC':
            dp[d[y+z+w]][i+1] += dp[d[x+y+z]][i]
            dp[d[y+z+w]][i+1] %= mod
ans = 0
for i in range(64):
  ans += dp[i][n-3]
  ans %= mod
print(ans)

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

vector<int> ans[MAXN];
int cur[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REPN(i, 1, n) {
		int v = i * (i + 1) / 2;
		if (v > n) {
			break;
		}
		if (v == n) {
			printf("Yes\n");
			int top = 1;
			REPN(j, 1, i + 1) {
				REP(k, 1, j) {
					ans[j].pb(ans[k][cur[k]++]);
				}
				cur[j] = SZ(ans[j]);
				while(SZ(ans[j]) < i) {
					ans[j].pb(top++);
				}
			}
			printf("%d\n", i + 1);
			REPN(j, 1, i + 1) {
				printf("%d ", SZ(ans[j]));
				REP(k, 0, SZ(ans[j])) {
					printf("%d ", ans[j][k]);
				}
				putchar('\n');
			}
			return;
		}
	}
	printf("No\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 4608
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 outer:
 for(;;){
  int h=ir.nextInt();
  int w=ir.nextInt();
  if(h==0&&w==0) return;
  int mi=1000000000,ah=-1,aw=-1;
  for(int i=1;i<=150;i++){
   int a=(int)Math.ceil(Math.sqrt(h*h+w*w-i*i));
   if(i>=a) break;
   if(i*i+a*a==h*h+w*w&&i<=h) a++;
   if(i*i+a*a<mi){
    mi=i*i+a*a;
    ah=i;
    aw=a;
   }
  }
  out.println(ah+" "+aw);
 }
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

Measured memory_bytes: 24520
/**
 *    DP
 *    25.04.2020 10:58
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s, t;
  cin >> s >> t;
  int sz = s.size(), tz = t.size();
  vector<vector<int>> dp (sz + 1, vector<int> (tz + 1, 0));
  for (int i = 1; i <= sz; i++) {
    for (int j = 1; j <= tz; j++) {
      if (s[i - 1] == t[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
      else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
    }
  }
  string ans = "";
  int m = sz, n = tz;
  while (m > 0 && n > 0) {
    if (s[m - 1] == t[n - 1]) {
      ans += s[m - 1];
      m--;
      n--;
    }
    else if (dp[m - 1][n] > dp[m][n - 1]) m--;
    else n--;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 35584
import sys
input = sys.stdin.readline

def algae(r, d, weight):

    for _ in range(10):
        weight_next = r*weight-d
        print(weight_next)
        weight = weight_next

def main():
    r,d,x = [int(i) for i in input().split()]
    algae(r,d,x)
    
# main関数呼び出し
if __name__ == "__main__":
    main() 

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define N 100003

using namespace std;

int main() {
	int s[N], n, i, j;

	cin >> n;

	for (i = 0; i < N; i++) {
		s[i] = 0;
	}

	for (i = 0; i < n; i++) {
		cin >> j;
		s[j]++;
		s[j + 1]++;
		s[j + 2]++;
	}

	j = s[0];
	for (i = 1; i < N; i++) {
		if (j < s[i]) {
			j = s[i];
		}
	}

	cout << j;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
typedef long long LL;
LL MAX=1e18;
int main(int argc, char* argv[])
{
	LL X,Y;
	cin>>X>>Y;
	if (X%Y==0){
		cout<<-1<<endl;;
		return 0;
	}
	int n=2;
	while (true){
		if (n*X%Y>0){
			cout<<n*X<<endl;
			return 0;
		}
		n++;
		if (n*X>MAX){
			cout<<-1<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = 2019;
		for(int i = 0; i < 2019; i++){
			for(int j = i+1; j < 2019; j++){
				long x = a+i, y = a+j;
				if(x > b || y > b) break;
				min = Long.min(min, (x*y)%2019);
			}
		}
		System.out.println(min);
	}

}


Measured memory_bytes: 23764
import string as st
string=[]
try:
    while True:
        s = input()#入力
        string =list(string)#list変換
        if not s :#空入力のときループぬける
            break
        string.extend(s)#list追加
        string=map(str,string)
        string="".join(string).lower()#str型変換と小文字
except EOFError:
    for i in range(len(st.ascii_lowercase)):
        print("{} : {}".format(st.ascii_lowercase[i],string.count(st.ascii_lowercase[i])))


Measured memory_bytes: 6676
n = int(input())
a = list(map(int, input().split()))

color = [False]*8
flex = 0
cnt = 0
for i in range(n):
    if a[i] < 400:
        color[0] = True
    elif a[i] < 800:
        color[1] = True
    elif a[i] < 1200:
        color[2] = True
    elif a[i] < 1600:
        color[3] = True
    elif a[i] < 2000:
        color[4] = True
    elif a[i] < 2400:
        color[5] = True
    elif a[i] < 2800:
        color[6] = True
    elif a[i] < 3200:
        color[7] = True
    else:
        flex += 1

for i in range(8):
    if color[i]:
        cnt += 1
mi = cnt
if mi == 0:
    mi = 1
cnt += flex

print(str(mi) + " " + str(cnt))


Measured memory_bytes: 61960
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int x = scan.nextInt();
    int a = scan.nextInt();

    if (0 <= x && a <= 9) {
      if (x < a) {
        System.out.println("0");
      } else {
        System.out.println("10");
      }
    }
  }
}


Measured memory_bytes: 23764