akhauriyash/Code-Regression huggingface dataset:
import Control.Applicative

main :: IO ()
main = do
  x <- read <$> getLine :: IO Int
  putStrLn (show (geth x) ++ ":" ++ show (getm x) ++ ":" ++ show (gets x))

geth :: Int -> Int
geth x = div x 3600

getm :: Int -> Int
getm x = mod (div x 60) 60

gets :: Int -> Int
gets x = mod x 60

Measured memory_bytes: 3496
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
double PI=acos(-1.0);
signed main(){
    ll a,b;cin>>a>>b;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <algorithm>
#define IL inline
#define N 3003
#define REP(a,b,c) for(a=b;a<=c;a++)
using namespace std;
typedef long long lol;
const int mod=1e9+7;
int n,m,ans,bar;
int f[2][2][N];
IL int rd(){
	int res=0;char c;while((c=getchar())<'0'||c>'9');
	while(c>='0'&&c<='9')res=res*10+c-'0',c=getchar();return res;
}
IL void inc(int &x,int y){x=(x+y)%mod;}
int main(){
	n=rd(),m=rd();int i,j,cur=0,nex=1;bar=sizeof(int)*(n+1);
	REP(i,1,n)f[cur][0][i]=1;f[cur][1][0]=1;
	REP(i,1,m){
		memset(f[nex][0],0,bar),memset(f[nex][1],0,bar);
		REP(j,0,n){
			if(j){
				inc(f[nex][j==1][j-1],f[cur][0][j]);
				inc(f[nex][1][j-1],f[cur][1][j]);
				inc(f[nex][j==1][j],f[cur][0][j]);
				inc(f[nex][1][j],f[cur][1][j]);
			}
			if(j!=n){
				inc(f[nex][0][j+1],f[cur][0][j]);
				inc(f[nex][1][j+1],f[cur][1][j]);
				inc(f[nex][0][j],f[cur][0][j]);
				inc(f[nex][1][j],f[cur][1][j]);
			}
		}			
		cur^=1,nex^=1;
	}
	REP(i,0,n)ans=(ans+f[cur][1][i])%mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int a,b,c;cin>>a>>b>>c;
  int ans;
  if(a%2==0||b%2==0||c%2==0)ans=0;
  else ans=min({a*b,b*c,c*a});
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 2000000

int H,j, A[MAX + 1];

void maxHeapify(int i){
    int l,r,largest;
    l = 2*i;
    r = 2*i+1;
    
    if(l <= H && A[l] > A[i]) largest = l;
    else largest = i;
    if(r <= H && A[r] > A[largest])largest = r;
    
    if(largest != i){
        j = A[i];
        A[i] = A[largest];
        A[largest] = j;
        maxHeapify(largest);
    }
}

int main(){
    scanf("%d",&H);
    
    for(int i = 1;i <= H;i++) scanf("%d",&A[i]);
    
    for(int i = H/2;i >= 1;i--) maxHeapify(i);
    
    for(int i = 1;i <= H;i++){
        printf(" %d",A[i]);
    }
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 3680
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 
#define MO 
int n,c;
inline void _Sol_()
{
	read(n);
	F(i,1,n){
		read(c);
		if(c%2)continue;
		if(c%3==0||c%5==0)continue;
		puts("DENIED");return;
	}
	puts("APPROVED");
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 256
import java.util.*;
import java.text.*;

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> dist = new ArrayList<Integer>();
		int t = in.nextInt();
		for(int j=0; j<t; j++){
			int n = in.nextInt();
			int k = in.nextInt();
			int a = in.nextInt();
			int b = 0;
			for(int i=0; i<n-1; i++){
				b = in.nextInt();
				dist.add(b-a);
				a = b;
			}
			Collections.sort(dist);
			int cost = 0;
			for(int i=0; i<n-k; i++){
				cost += dist.get(i);
			}
			System.out.println(cost);
			dist.clear();
		}
	}
}

Measured memory_bytes: 14000
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N; cin >> N;
  if (N==1) cout << "Hello World";
  else { int A, B; cin >> A >> B; cout << A+B << endl; }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 173, task a, 2020/07/05
//ms,
/*
*/

int main(void){
  int N;
  cin >>N;
  cout << ((N-1)/1000+1)*1000 - N;
  return 0;
}
/*
*/


Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

char c1[210];
char c2[101];
char p[101];

int main(){
	int i = 0;
	while(1){
		scanf("%c", &c1[i]);
		if(c1[i]=='\n'){
			c1[i] = '\0';
			break;
		}
		i++;
	}
	i = 0;
	while(1){
		scanf("%c", &p[i]);
		if(p[i]=='\n'){
			p[i] = '\0';
			break;
		}
		i++;
	}
	strcpy(c2, c1);
	strcat(c1, c2);
	if(strstr(c1, p) == NULL) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3220
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        System.out.println((int)Math.min(b, a * n));
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
}


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

int main() {
	char s[20];
	cin >> s;
	cout << s[0] << s[1] << s[2] << s[3] << s[4] << " ";
	cout << s[6] << s[7] << s[8] << s[9] << s[10] << s[11] << s[12] << " ";
	cout << s[14] << s[15] << s[16] << s[17] << s[18];
	return 0;
}


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

using namespace std;

int main(){
  long long a,b,c,d;
  cin>>a>>b>>c>>d;
  long long p1=a*d;
  long long p2=b*d;
  long long p3=a*c;
  long long p4=b*c;
  cout<<max(max(p1,p2),max(p4,p3));
}



Measured memory_bytes: 3636
n,k=map(int,input().split())
d=[]
a=[]
for i in range(k):

	d.append(int(input()))
	a.extend(list(map(int,input().split())))
x=0    
for s in range(1,n+1):
	if s not in a:
		x+=1
        
print(x)

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

struct UnionFind
{
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (data[y] < data[x])
                swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y)
    {
        return root(x) == root(y);
    }
    int root(int x)
    {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x)
    {
        return -data[root(x)];
    }
};

struct Edge
{
    int from, to, cost;
    Edge(int from, int to, int cost) : from(from), to(to), cost(cost) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

bool operator<(const Edge &e, const Edge &f)
{
    return e.cost > f.cost;
}

vector<int> dijkstra(const Graph &g, int s)
{
    vector<int> d(g.size(), INF);
    d[s] = 0;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, s)); // P(dis, pos)
    while (!que.empty())
    {
        int dist = que.top().first;
        int v = que.top().second;
        que.pop();
        if (d[v] < dist)
            continue;
        for (const auto &e : g[v])
        {
            if (d[e.to] <= d[v] + e.cost)
                continue;
            d[e.to] = d[v] + e.cost;
            que.push(P(d[e.to], e.to));
        }
    }
    return d;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    Graph g(n);
    for (int i = 0; i < n; i++)
    {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            int v, c;
            cin >> v >> c;
            g[u].push_back(Edge{u, v, c});
        }
    }
    vector<int> res = dijkstra(g, 0);
    for (int i = 0; i < n; i++)
        cout << i << " " << res[i] << endl;
}



Measured memory_bytes: 3244
#include <stdio.h>

int main(){
	int n, x, i, j, k, c;
	scanf("%d %d", &n, &x);
	while(1){
		if(n == 0 && x == 0)break;
		c = 0;
		for(i = 1; i < n; i++){
			for(j = i + 1; j < n; j++){
				for(k = j + 1; k <= n; k++){
					if(i + j + k == x){
						c++;
					}
				}
			}
		}
		printf("%d\n", c);
		scanf("%d %d", &n, &x);
	}
	return 0;
}

Measured memory_bytes: 600
import sys
import sys
import heapq
def dijkstra(s, es):
    '''Single Source Shortest Path (cost must not be negative)
    arguments
        s : source node number
        es: adjacency list
    returns
        cs: shortest path costs to each nodes
    '''
    INF=sys.maxsize
    cs=[INF]*len(es)
    ss=[-1]*len(es)
    cs[s],hq=0,[]
    heapq.heapify(hq)
    heapq.heappush(hq,(cs[s],s))
    while hq:
        d,v=heapq.heappop(hq)
        if cs[v]<d:continue
        for t,c in es[v]:
            if cs[t]>cs[v]+c:
                cs[t]=cs[v]+c
                ss[t]=v
                heapq.heappush(hq,(cs[t],t))
    return cs,ss
def main():
    N,M=tuple(map(int,sys.stdin.readline().split()))
    es=[[] for _ in range(N)]
    for _ in [0]*M:
        a,b=tuple(map(int,sys.stdin.readline().split()))
        a,b=a-1,b-1
        es[a].append((b,1))
        es[b].append((a,1))
    cs,ss=dijkstra(0,es)
    if ss.count(-1)>1:print('No')
    else:
        print('Yes')
        for d in ss[1:]:print(str(d+1))
if __name__=='__main__':main()

Measured memory_bytes: 63824
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
vector<int> G[100100];

signed main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    int a[100100] = {0};
    for(int i = 1;i < s.size();i++){
        if(s[i] == 'C' && s[i-1] == 'A'){
            a[i] = a[i-1] + 1;
        }else{
            a[i] = a[i-1];
        }
    }
    rep(i,q){
        int l,r;
        cin >> l >> r;
        int ans = 0;
        if(l == 1){
           cout << a[r-1] << endl;
        }else{
            ans = a[r-1] - a[l-2];
            if(s[l-1] == 'C' && s[l-2] == 'A')ans--;
            cout << ans << endl;
        }
        
    }

    
    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_d
// rm -r -f test;oj dl http://abc122.contest.atcoder.jp/tasks/abc122_a

Measured memory_bytes: 4224
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iterator>
#include<math.h>
#define debug() puts("what the fuck")
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
int main()
{
    double ax,ay,bx,by,cx,cy,px,py,mx,my,nx,ny,a1x,a1y,b1x,b1y,c1x,c1y;
    while(cin>>ax>>ay>>bx>>by>>cx>>cy>>px>>py)
    {
        mx=bx-ax;my=by-ay;
        nx=cx-ax;ny=cy-ay;
        a1x=ax-px;a1y=ay-py;
        b1x=bx-px;b1y=by-py;
        c1x=cx-px;c1y=cy-py;
        if(abs(abs(mx*ny-my*nx)-(abs(a1x*b1y-b1x*a1y)+abs(a1x*c1y-c1x*a1y)+abs(c1x*b1y-b1x*c1y)))<=1e-6)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;

    }

    return 0;
}



Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
long long x[100010],p[100010];
int main()
{	int n,s,l=1,r;long long ans=0;cin>>n>>s;r=n;
	for(int i=1;i<=r;i++) cin>>x[i]>>p[i];
	while(l<=r)
	{	if(s<=x[l]) cout<<ans+x[r]-s,exit(0);
		if(s>=x[r]) cout<<ans+s-x[l],exit(0);
		ans+=x[r]-x[l];
		if(p[l]>=p[r]) while(p[l]>=p[r]&&l<r) p[l]+=p[r--];
		else while(p[l]<p[r]&&l<r) p[r]+=p[l++];
	}
}


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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0;i<N;++i) cin >> d[i];
  sort(d.begin(),d.end());
  cout<<d[N/2]-d[N/2-1]<<endl;
  
}

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define all(e) (e).begin(), (e).end()


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

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

int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    unordered_set<string> s;
    int n; cin >> n;
    for (int i = 0; i < n; ++i) {
        string str; cin >> str;
        s.insert(str);
    }
    cout << s.size() << endl;
    return 0;
}



Measured memory_bytes: 17752
import numpy as np
N=int(input())
S_list = np.zeros(N)
#S_list = np.zeros(N,dtype=str)
e_list = "abcdefghijklmnopqrstuvwxyz"

for i in range(N):
  s = input()
  n = 0
  for k in range(len(s)):
    n = n + (e_list.index(s[k])+1)*(100**k)
  S_list[i] = n
print(len(np.unique(S_list)))


Measured memory_bytes: 31748
// #include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
//#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
const int INF = (int)2e9 + 1;
const long long LINF = (long long)9e18 + 1;

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

  string S;
  cin >> S;
  if (S[0] == 'S') {
    cout << "Cloudy" << endl;
  }
  if (S[0] == 'C') {
    cout << "Rainy" << endl;
  }
  if (S[0] == 'R') {
    cout << "Sunny" << endl;
  }

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int A = 0;
  int B = 0;
  
  for (int i = 0; i < N; i++) {
    int X;
    cin >> X;
    if (X % 2 == 0) {
      A++;
      if (X % 3 == 0 || X % 5 == 0) {
        B++;
      }
    }
  }
  if (A == B) {
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
typedef long long ll;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
/*inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}*/
#define gc getchar
#define pc putchar
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
#define rank __RANK
inline ll read(){
	register ll x=0,f=1;register char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
const int maxn = 2e5+233;
int front,rear,n,m;
int q[maxn];
bool vis[maxn];
char s[maxn];
vector<int> edge[maxn];
int cnt[maxn][2];
int main(){
	n = rd(),m = rd();
	scanf("%s",s+1);
	Rep(i,1,n) s[i] -= 'A';
	Rep(i,1,m){
		int a = rd(),b = rd();
		edge[a] . push_back(b);
		edge[b] . push_back(a);
		cnt[a][s[b]]++;
		cnt[b][s[a]]++; 
	}
	front = rear = 0;
	Rep(i,1,n) if(cnt[i][0]==0 || cnt[i][1]==0){
		q[rear++] = i;
		vis[i] = true;
	}
	while(front < rear){
		int u = q[front++];
	//	printf("%d\n",u);
		for(auto v : edge[u]){
			cnt[v][s[u]]--;
			if((cnt[v][0]==0 || cnt[v][1]==0) && !vis[v]){
				q[rear++] = v;
				vis[v] = true;
			}
		}
	}
	if(rear==n){
		puts("No");
	} else{
		puts("Yes");
	}
	return 0;
}

Measured memory_bytes: 12800
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using static System.Console;
using static System.Math;

namespace abc112_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var x = new int[n];
            var y = new int[n];
            var h = new int[n];
            for (int i = 0; i < n; i++){
                int[] input = ReadLine().Split().Select(int.Parse).ToArray();
                x[i] = input[0];
                y[i] = input[1];
                h[i] = input[2];
            }

            Tuple<int, int, int> sample=new Tuple<int, int, int>(0,0,0);
            for (int i = 0; i < n; i++)
            {
                if(h[i] != 0){
                    sample = new Tuple<int, int, int>(x[i], y[i], h[i]);
                    break;
                }
            }

            for (int j = 0; j <= 100; j++){
                for (int k = 0; k <= 100; k++){
                    int tmp = sample.Item3+Abs(sample.Item1-j)+Abs(sample.Item2-k);

                    bool judge = true;
                    for (int i = 0; i < n; i++){
                        if(h[i] != Max(tmp-Abs(x[i]-j)-Abs(y[i]-k), 0)){
                            judge = false;
                        }
                    }
                    if(judge){
                        WriteLine($"{j} {k} {tmp}");
                        return;
                    }
                }
            }

        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template<int p = 1000000007>
class Z {
	ll x;
public:
	Z(ll X) :x((X + p) % p) { ; }
	Z() :x(0) { ; }
	Z &operator=(ll y) { return *this = Z(y); }
	Z operator-() const { return Z(-x); }
	Z operator+(ll y) const { return Z(x + y); }
	Z &operator+=(ll y) { return *this = *this + y; }
	Z operator-(ll y) const { return Z(x - y); }
	Z &operator-=(ll y) { return *this = *this - y; }
	Z operator*(ll y) const { return Z(x * y); }
	Z &operator*=(ll y) { return *this = *this * y; }
	Z operator/(ll y) const { return *this * Z(y).pow(p - 2); }
	Z &operator/=(ll y) const { return *this = *this / y; }
	Z operator+(const Z &r) const { return *this + r.x; }
	Z &operator+=(const Z &r) { return *this += r.x; }
	Z operator-(const Z &r) const { return *this - r.x; }
	Z &operator-=(const Z &r) { return *this -= r.x; }
	Z operator*(const Z &r) const { return *this * r.x; }
	Z &operator*=(const Z &r) { return *this *= r.x; }
	Z operator/(const Z &r) const { return *this / r.x; }
	Z &operator/=(const Z &r) { return *this /= r.x; }
	Z pow(int i) {
		if (i == 0) return Z(1);
		if (i % 2) return *this * pow(i - 1);
		Z tmp = pow(i / 2);
		return tmp * tmp;
	}
	ll get() { return x; }
	friend istream &operator>>(istream &istr, Z &z) { return istr >> z.x; }
	friend ostream &operator<<(ostream &ostr, const Z &z) { return ostr << z.x; }
};

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

	ll N, K;
	cin >> N >> K;
	vector<Z<>> fact(N + 1);
	fact[0] = 1;
	REP(i, N) fact[i + 1] = fact[i] * (i + 1);
	FOR(i, 1, K + 1) {
		if (i <= N - K + 1) {
			cout << fact[N - K + 1] * fact[K - 1] / fact[i] / fact[N - K + 1 - i]
				/ fact[i - 1] / fact[K - i] << endl;
		}
		else {
			cout << 0 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <ctype.h>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define ENDL '\n'
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FOR_EACH(i, v) for (auto&& i : v)

int N;

bool compare(const pair<int, int>& p1, const pair<int, int>& p2)
{
	return p1.second < p2.second;
}

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

	cin >> N;
	vector<pair<int, int>> robots(N);
	robots.clear();
	FOR(i, N) {
		int x;
		int l;
		cin >> x >> l;
		robots.push_back(make_pair(x - l, x + l));
	}

	sort(robots.begin(), robots.end(), compare);

	int ans = 0;
	int last = -1000000001;
	FOR(i, N) {
		if (last <= robots[i].first) {
			ans++;
			last = robots[i].second;
		}
	}

	cout << ans << ENDL;

	return 0;
}

Measured memory_bytes: 3992
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
using namespace std;
typedef long long ll;
const int maxn = 10005;

int n,m;
int a[maxn];
int cost[10] = {-1,2,5,5,4,5,6,3,7,6};
int f[7][maxn],pnt[7][maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "w", stdout);
#endif
  cin>>n>>m;
  for(int i=0;i<m;i++)cin>>a[i];
  sort(a,a+m);
  vector<int>d;
  for(int i=m-1;i>=0;i--){
    bool flag=0;
    for(int j=i+1;j<m;j++)if(cost[a[j]]==cost[a[i]]){
      flag=1;
    }
    if(!flag)d.push_back(a[i]);
  }
  sort(d.begin(),d.end());
  memset(f,-1,sizeof(f));
  memset(pnt,-1,sizeof(pnt));
  f[0][0] = 0;
  for(int i=0;i<d.size();i++)
    for(int j=0;j<=n;j++){
      if(f[i][j]==-1)continue;
      if(f[i+1][j]==-1||f[i+1][j]<f[i][j]) {
        f[i + 1][j] = f[i][j];
        pnt[i + 1][j] = j;
      }
      for(int k=1;k*cost[d[i]]+j<=n;k++){
        int tmp=k*cost[d[i]]+j;
        if(f[i+1][tmp]==-1||f[i+1][tmp]<f[i][j]+k){
          f[i+1][tmp] = f[i][j]+k;
          pnt[i+1][tmp]=j;
        } else if(f[i+1][tmp]==f[i][j]+k){
          int pre = pnt[i+1][tmp];
          if((tmp-pre)/cost[d[i]]<k){
            f[i+1][tmp] = f[i][j]+k;
            pnt[i+1][tmp]=j;
          }
        }
      }
    }
  int x=d.size(),y=n;
    while(x>0){
      int pre = pnt[x][y];
      int cnt = (y-pre)/(cost[d[x-1]]);
      while(cnt--){
        cout<<d[x-1];
      }
      x--;
      y=pre;
    }
    cout<<endl;
  return 0;
}

Measured memory_bytes: 768
n=int(input())
s=input()
s_list=list(s)
for i in range(len(s_list)):
    new_s=ord(s_list[i])+n
    if new_s<=90:
        s_list[i]=chr(new_s)
    else:
        s_list[i]=chr(new_s-26)
str_changed = "".join(s_list)
print(str_changed)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
std::ostream&
operator<<( std::ostream& dest, __int128_t value )
{
    std::ostream::sentry s( dest );
    if ( s ) {
        __uint128_t tmp = value < 0 ? -value : value;
        char buffer[ 128 ];
        char* d = std::end( buffer );
        do
        {
            -- d;
            *d = "0123456789"[ tmp % 10 ];
            tmp /= 10;
        } while ( tmp != 0 );
        if ( value < 0 ) {
            -- d;
            *d = '-';
        }
        int len = std::end( buffer ) - d;
        if ( dest.rdbuf()->sputn( d, len ) != len ) {
            dest.setstate( std::ios_base::badbit );
        }
    }
    return dest;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	int n;
	long long int t;
	vector <long long int> v;
 
	cin >> n;
 
	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
	}
 
	sort(v.begin(),v.end());
 
	__int128 val = v[0];
	__int128 threshold = 1000000000000000000;
	for(int i=1;i<n;i++)
	{
		if(val*v[i]>threshold)
		{
			cout << -1 << '\n';
			return 0;
		}
		val*=v[i];
	}
 
	cout << val << '\n';
 
    return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;


ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/******************************************
** A main function is start from here  ****
*******************************************/
int main(){
  int A, B;
  cin >> A >> B;
  if(A<=8 and B<=8) cout << "Yay!";
  else cout << ":(";
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)] 
happy = [[0, 0, 0] for _ in range(n+1)]
for i in range(n):
    for j in range(3):
        happy[i + 1][j % 3] = abc[i][j % 3] + max(happy[i][(j + 1) % 3], happy[i][(j + 2) % 3])
print(max(happy[-1][i] for i in range(3)))        
    
    

Measured memory_bytes: 76248
package main

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

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var N int
	con.Scan(&N)
	m := map[int]int{}
	for i := 0; i < N; i++ {
		var a int
		con.Scan(&a)
		m[a]++
	}
	d := 0
	for _, v := range m {
		if v > 1 {
			d += v - 1
		}
	}
	c := len(m)
	if d%2 == 1 {
		c--
	}
	con.Println(c)
	return nil
}


Measured memory_bytes: 7296
#include <iostream>
using namespace std;
typedef long long LL;
int main() {
    LL a, b;
    cin >> a >> b;
    int cnt = 0;
    while (a > 0 && a <= b) {
        cnt++;
        a <<= 1;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

long long test_cases;
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);

    /* cin >> test_cases; */
    test_cases = 1;

    int a, b;
    while (test_cases > 0)
    {

        cin >> a >> b;

        cout << a*b << endl;



        test_cases--;
    }

    
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>

using namespace std;
void judge(vector<int>& vec_t)
{
	vector<int>::iterator i, j;
	int temp = 0;
	int sum_t=0;
	for (i = vec_t.begin(), j = vec_t.begin();i != vec_t.end();i++)
		if (*i > * j) j = i;
	temp = *j;
	vec_t.erase(j);
	for (i = vec_t.begin();i != vec_t.end();i++)
		sum_t += *i;
	if (sum_t > temp)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return;

}

int main()
{
	int n,i,temp;
	vector<int> vec_t;
	cin >> n;
	for (i = 0;i < n;i++)
	{
		cin >> temp;
		vec_t.push_back(temp);
	}
	judge(vec_t);
	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>

#define INF 2<<27

int dp[50010];
int n, m;
int c[20];

int min(int a, int b)
{
    if(a > b){
        return b;
    }else{
        return a;
    }
}

int intcmp(const void *a, const void *b)
{
    return *(int*)a < *(int*)b;
}

int dfs(int r)
{
    int i;
    for(i = 0; i < m; i++){
        if(r-c[i] < 0){
            continue;
        }else if(dp[r-c[i]] == INF){
            dp[r] = min(dp[r], dfs(r-c[i])+1);
        }else{
            dp[r] = min(dp[r], dp[r-c[i]]+1);
        }
    }
    return dp[r];
}

int main()
{
    int i;
    scanf("%d %d", &n, &m);
    for(i = 0; i < m; i++) scanf("%d", c+i);
    qsort(c, m, sizeof(int), intcmp);

    for(i = 0; i <= n; i++) dp[i] = INF;
    dp[0] = 0; dp[1] = 1;

    printf("%d\n", dfs(n));

    return 0;
}


Measured memory_bytes: 2104
p=[0]*4

for i in range(3):
    a,b=map(int,input().split())
    p[a-1]+=1
    p[b-1]+=1
    
odd=0
for i in range(4):
    if p[i]%2==1:
        odd+=1
        
if odd<=2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 38384
import java.io.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
class Main{
    public static void main(String[] a){
    	int n = 0;
    	
    	Scanner scan = new Scanner(System.in);
    	while (scan.hasNext()){
    	n = scan.nextInt();
    	int num = n * (n+1)/2+1;
    	System.out.println(num);
    	}
    	
    	}
 }

Measured memory_bytes: 25816
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97 '0'=0x30=48
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef string str;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() 
{
  int d,t,s;
  cin>>d>>t>>s;
  if(t*s>=d)cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3644
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
long long mod = 1e9 + 7;
const int N = 3e5 + 500;

long long n, m, u, v, k, t, q, a, h;



int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n >> m;
   n*=3;
   n += m;
   
   cout << n / 2 << endl;
}






Measured memory_bytes: 256
N,M = map(int,input().split())
L_list = []
R_list = []
count = 0
min_mn=float('inf')
max_mn=0
for i in range(M):
    L,R=map(int,input().split())
    min_mn = min(min_mn,R)
    max_mn = max(max_mn,L)

for i in range(1,N+1):
    if(i>=max_mn and i<=min_mn):
        count += 1
print(count)


Measured memory_bytes: 3060
#include<cstdio>
main(){int a,b,d=0,c;while(scanf("%d%d",&a,&b),a){if(d++)puts("");c=0;for(;a<=b;a++)if(a%4<1)if(a%25)c++,printf("%d\n",a);else if(a%16<1)c++,printf("%d\n",a);if(!c)puts("NA");}}

Measured memory_bytes: 0
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <functional>
#include <string>
#include <cstring>
#include <sstream>
#include <deque>
#define fir first
#define sec second
using namespace std;

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

const int inf1=1e9+9;
const ll inf2=8e18+9;
const ll mol=1e9+7;
const int maxn=3e7+9;
const ll maxx=1e6+9;

int n,num;
int cnt[maxx],sit[maxx]={1};

int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&num),cnt[num]++;
    for(int i=1;i<maxx;i++)
    {
        if(sit[i]) continue;
        if(cnt[i]==0) {sit[i]=1;continue;}
        if(cnt[i]>1) sit[i]=1;
        for(int j=i+i;j<maxx;j+=i) sit[j]=1;
    }
    int ans=0;
    for(int i=0;i<maxx;i++) ans+=1-sit[i];
    printf("%d\n",ans);
}


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

int main() {
  int64_t H, W;
  cin >> H >> W;
  int64_t ans;
  if (H==1 || W == 1) {
    ans = 1;
  }
  else if (H%2==0 && W%2==0) {
    ans = H * W / 2;
  }
  else if (H%2==1 && W%2==1) {
    ans = H*W/2 + 1;
  }
  else {
    ans = H * W/ 2;
  }
  cout << ans << endl;

}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }


signed main(void){
  string s;cin >> s;
  int ans=(int)s.size();
  rep(i,s.size()){
    if(s[i]=='A')break;
    ans--;
  }
  for(int i=s.size()-1;i>0;--i){
    if(s[i]=='Z')break;
    ans--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 764
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, a[200009], b[200009], imos[100009], bit[100009]; vector<int> g[100009], gs[100009];
void add(int pos, int val) {
	for (int i = pos + 1; i <= 100000; i += i & (-i)) bit[i] += val;
}
int sum(int pos) {
	int ret = 0;
	for (int i = pos; i >= 1; i -= i & (-i)) ret += bit[i];
	return ret;
}
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i]; a[i]--; b[i] -= 2;
		imos[a[i]]++;
		imos[b[i] + 1]--;
		g[b[i]].push_back(i);
		gs[a[i]].push_back(i);
	}
	for (int i = 0; i < 100000; i++) imos[i + 1] += imos[i];
	int rb = *max_element(imos, imos + 100000), ra = 0;
	for (int i = 0; i <= 100000; i++) {
		for (int j : gs[i]) add(i, 1);
		for (int j : g[i]) add(a[j], -1), add(i, 1);
		for (int j : g[i]) ra = max(ra, sum(i + 1) - sum(a[j]));
	}
	cout << ra << ' ' << rb << endl;
	return 0;
}

Measured memory_bytes: 15688
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
    int w,h,x,y;
    int ans;
    cin >> w >> h >> x >> y;
    if(x * 2 == w && y * 2 == h){
        ans = 1;
    }else{
        ans = 0;
    }
    cout << (double)w * h / 2 << ' ' << ans;
}



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

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pll;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fir first
#define sec second

#define fo0(i,a,b) for(int i=(a);i<(b);i++)
#define fo1(i,a,b) for(int i=(a);i<=(b);i++)
#define fd0(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define fd1(i,a,b) for(int i=(a);i>=(b);i--)
#define mset(a,b) memset(a,(b),sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))

template<typename T> inline void in(T &x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9')
{if(ch=='-')fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T> void out(T x){if(x<0){putchar('-');x=-x;}if(x/10)out(x/10);putchar(x%10+'0');}
template<typename T> inline void outln(T x){out(x);putchar(10);}
template<typename T> inline void outsp(T x){out(x);putchar(' ');}
template<typename T> inline T gcd(T a, T b){T t;if(a>b){while(b){
t=b;b=a%b;a=t;}return a;}else{while(a){t=a;a=b%a;b=t;}return b;}}
template<typename T> inline T lcm(T a, T b){return a/gcd(a,b)*b;}

const int N = 500005;

int n, tim[N];
vector<int> a[N];

int main(){
	in(n);
	int t = sqrt(n*2);
	if(1ll * t * (t + 1) / 2 != n)	return puts("No"), 0;
	puts("Yes");
	int k = t + 1;
	outln(k);
	if(n == 1){
		printf("%d %d\n%d %d\n", 1, 1, 1, 1);
		return 0;
	}
	a[1].pb(1); a[1].pb(2);
	a[2].pb(2); a[2].pb(3);
	a[3].pb(1); a[3].pb(3);
	int now = 3;
	fo1(i, 4, k){
		fo1(j, now + 1, now + i - 1){
			a[i].pb(j);
			a[j - now].pb(j);
		}
		now += i - 1;
	}
	fo1(i, 1, k){
		outsp(t);
		fo1(j, 0, t-1)
			outsp(a[i][j]);
		putchar(10);
	}
	return 0;
}

Measured memory_bytes: 14592
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Main {

    public static String lcs(String s, String t) {
        int n = s.length();
        int m = t.length();

        int[][] dp = new int[n + 1][m + 1];
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= m; j++) {
                if(s.charAt(i - 1) == t.charAt(j - 1)) {
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                } else {
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
                }
            }
        }

        char[] result = new char[dp[n][m]];
        int k = dp[n][m] - 1;
        int i = n, j = m;
        while(i > 0 && j > 0) {
            if(s.charAt(i - 1) == t.charAt(j - 1)) {
                result[k] = s.charAt(i - 1);
                k--; i--; j--;
            } else if(dp[i][j] == dp[i - 1][j]) {
                i--;
            } else {
                j--;
            }
        }
        return new String(result);
    }

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

        System.out.println(lcs(s, t));
  }
}


Measured memory_bytes: 83380
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let an=t.n(5)
  an = an.sort((a,b)=>{return (b%10==0?10:b%10)-(a%10==0?10:a%10)})
  let time=an[0]
  if(time%10==0)time+=an[1]
  else time+=10-(time%10)+an[1]
  if(time%10==0)time+=an[2]
  else time+=10-(time%10)+an[2]
  if(time%10==0)time+=an[3]
  else time+=10-(time%10)+an[3]
  if(time%10==0)time+=an[4]
  else time+=10-(time%10)+an[4]
  t.o(time)
}
main()

Measured memory_bytes: 7372
// 4/25
// 区間スケジューリング問題

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N;
    pair<int, int> itv[100000];

    cin >> N;
    for (int i = 0; i < N; i++) {
        int x, l;
        cin >> x >> l;
        itv[i].first = x + l;
        itv[i].second = x - l;
    }

    sort(itv, itv + N);

    int ans = 0, d = -1000000000;

    for (int i = 0; i < N; i++) {
        if (itv[i].second >= d) {
            d = itv[i].first;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long a, b, k;
  cin >> a >> b >> k;
  a -= k;
  if(a < 0) {
    b += a;
    a = 0;
    b = max(b, 0ll);
  }
  cout << a << ' ' << b << '\n';
}


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

bool IsReachable(int now_x, int now_y, int dest_x, int dest_y, int time_span) {
	if (time_span == 0) {
		if (now_x == dest_x && now_y == dest_y) return true;
		else return false;
	}
	int dist = abs(now_x - dest_x) + abs(now_y - dest_y);
	if (dist % 2 != time_span % 2) return false;
	if (dist > time_span) return false;
	return true;
}

int main() {
	int N;
	cin >> N;
	int now_x = 0;
	int now_y = 0;
	int time1 = 0;
	bool ans = true;
	for (int i = 0; i < N; i++) {
		int dest_x, dest_y, time2;
		cin >> time2 >> dest_x >> dest_y;
		if (ans) {
			if (IsReachable(now_x, now_y, dest_x, dest_y, time2 - time1)) {
				now_x = dest_x;
				now_y = dest_y;
				time1 = time2;
			}
			else {
				ans = false;
			}
		}
	}
	if (ans) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAXSIZE 100

void insertionSort(int a[],int size);
void printArray(int a[],int size);

int main(void){
    int i,size,array[MAXSIZE];
    scanf("%d",&size);

    for(i=0;i<size;i++){
        scanf("%d",&array[i]);
    }

    insertionSort(array,size);

    return 0;
}

void insertionSort(int a[],int size){
    int i,j,temp;
    for(i=0;i<size;i++){
        temp=a[i];
        for(j=i-1;j>=0&&a[j]>temp;j--){
            a[j+1]=a[j];
        }
        a[j+1]=temp;
     	printArray(a,size);
    }
}

void printArray(int a[],int size){
    int i;
    printf("%d",a[0]);
    for(i=1;i<size;i++){
    printf(" %d",a[i]);
    }
    printf("\n");
}






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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

template <typename T>
struct Vector {
  T x, y;
  T Norm() const { return std::sqrt(x * x + y * y); }
  Vector& operator+=(const Vector& v) {
    (*this).x += v.x;
    (*this).y += v.y;
    return *this;
  }
  Vector operator+(const Vector& v) const { return Vector(*this) += v; }
  Vector& operator-=(const Vector& v) {
    (*this).x -= v.x;
    (*this).y -= v.y;
    return *this;
  }
  Vector operator-(const Vector& v) const { return Vector(*this) -= v; }
  Vector& operator*=(T t) {
    (*this).x *= t;
    (*this).y *= t;
    return *this;
  }
  Vector operator*(T t) const { return Vector(*this) *= t; }
  bool operator<(const Vector& v) const {
    if (x != v.x) {
      return x < v.x;
    }
    return y < v.y;
  }
  Vector Rot90() const { return {-y, x}; }
};

template <typename T>
std::ostream& operator<<(std::ostream& os, const Vector<T>& v) {
  os << "(" << v.x << "," << v.y << ")";
  return os;
}

using Vec = Vector<double>;

int main() {
  in(int, n);
  vector<Vec> v(n);
  rep(i, n) cin >> v[i].x >> v[i].y;
  sort(all(v));
  double sum = 0;
  int cnt = 0;
  do {
    rep(i, n - 1) sum += (v[i + 1] - v[i]).Norm();
    ++cnt;
  } while (next_permutation(all(v)));
  cout << setprecision(20);
  out(sum / cnt);
}


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

class Cards {
public:
  char m;
  int n;
};
int main() {
  int N;
  cin >> N;
  Cards b[N], s[N];
  for (int i=0; i<N; i++) {
    cin >> b[i].m >> b[i].n;
    s[i]=b[i];
  }
  for (int i=0; i<N-1; i++) {
    for (int j=N-1; j>i; j--) {
      if (b[j].n<b[j-1].n) {
        swap(b[j],b[j-1]);
      }
    }
  }
  int min;
  for (int i=0; i<N; i++) {
    min=i;
    for (int j=i; j<N; j++) {
      if (s[j].n<s[min].n) {
        min=j;
      }
    }
    swap(s[i],s[min]);
  }
  for (int i=0; i<N; i++) {
    cout << (i==0?"":" ") << b[i].m << b[i].n << flush;
  }
  printf("\n");
  printf("Stable\n");
  bool f=0;
  for (int i=0; i<N; i++) {
    if (b[i].m != s[i].m) {
      f=1;
    }
    cout << (i==0?"":" ") << s[i].m << s[i].n << flush;
  }
  printf("\n");
  if (f) {
    printf("Not stable\n");
  } else {
    printf("Stable\n");
  }
  return 0;
}

Measured memory_bytes: 3088