akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

/*--------------------template--------------------*/
void dijkstra(Graph &g, Array &d, int s)
{
	d.assign(g.size(), INF);
	d[s] = 0;
	typedef pair<Weight, int> P;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		Weight dist = que.top().first;
		int v = que.top().second;
		que.pop();
		if (d[v] < dist) continue;
		REP(i, g[v].size())
		{
			Edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}


int main()
{
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	s--; t--;
	Graph g(n);
	REP(i, m)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		add_edge(g, a, b, 1);
		add_edge(g, b, a, 1);
	}
	Array d1, d2;
	dijkstra(g, d1, s);
	dijkstra(g, d2, t);
	int dist = d1[t] - 1;
	vi v1(111111), v2(111111);
	REP(i, d1.size()) if (d1[i] != INF) v1[d1[i]]++;
	REP(i, d2.size()) if (d2[i] != INF) v2[d2[i]]++;
	ll ans = 0;
	REP(i, v1.size())
	{
		int t = dist - i - 1;
		if(t>=0&&t<111111) ans += v2[t]*v1[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13576
#pragma comment(linker, "/STACK:1073741824")
#pragma GCC optimize("Ofast")

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<fstream>
#include<iterator>
#include<functional>
#include<bitset>
#include<memory>
#include<sstream>
#include<new>
#include<cassert>
#include<iomanip>

using namespace std;
using namespace placeholders;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<bool, bool> pbb;
typedef pair<ld, ld> pdd;

const int inf = (int)1e9 + 9;
const ll linf = (ll) 1e18;
const ld eps = 1e-9;
const int mod = (int) 1e9 + 7;
const int smod = 16769023;
const ll lmod = 27644437;
const ld pi = acos(-1);

#define it(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define scn second
#define sgn(x) (x > 0 ? 1 : (x == 0 ? 0 : -1))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a, b;
	cin >> a >> b;
	cout << (a % 500 > b ? "No" : "Yes");
}

Measured memory_bytes: 256
/*
Author: CNYALI_LK
LANG: C++
PROG: E.cpp
*/
#include<bits/stdc++.h>
#define up(a,b,c) for (int a(b),end##a(c);a<=end##a;++a)
#define down(a,c,b) for (int a(b),end##a(c);a>=end##a;--a)
#define uup(a,c,b) for (int a(b),end##a(c);a<=end##a;++a)
#define udown(a,b,c) for (int a(b),end##a(c);a>=end##a;--a)
#define endl '\n'
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
struct inout{
	static const int ibufl=1<<25;
	static const int obufl=1<<25;
	char in_buf[ibufl],out_buf[obufl],*inf,*ouf;
	inout(){
		inf=in_buf;ouf=out_buf;
	}
	void init(){
		fread(in_buf,1,ibufl,stdin);
	}
	inout& operator >>(int &a){
		int fh=1;
		while(!(isdigit(*inf)||*inf=='-'))++inf;
		if(*inf=='-')fh=-1,++inf;
		a=0;
		while(isdigit(*inf)){a=a*10+*inf-'0';++inf;}
		a*=fh;
		return *this;
	}
	inout& operator >>(char &a){
		while(*inf==' '||*inf=='\n')++inf;
		a=*inf;
		++inf;
		return *this;
	}
	inout& operator >>(char *a){
		while(*inf==' '||*inf=='\n')++inf;
		while(!(*inf==' '||*inf=='\n'||*inf=='\0')){*a=*inf;++inf;++a;}
		*a='\0';
		return *this;
	}

	inout& operator >>(double &a){
		int fh=1;
		double s;
		while(!(isdigit(*inf)||*inf=='-'||*inf=='.'))++inf;
		if(*inf=='-')fh=-1,++inf;
		a=0;
		while(isdigit(*inf)){a=a*10+*inf-'0';++inf;}
		if(*inf=='.'){
			s=0.1;
			++inf;
			while(isdigit(*inf)){
				a+=s*(*inf-'0');
				++inf;
				s*=0.1;
			}
		}
		if(*inf=='E'||*inf=='e'){
			int ss;
			++inf;
			*this>>ss;
			if(ss>0){
				while(ss){
					--ss;
					a*=10;
				}
			}
			if(ss<0){
				while(ss){
					++ss;
					a/=10;
				}
			}
			
		}
		a*=fh;
		return *this;
	}
	void writeint(int x){
		if(x/10)writeint(x/10);
		*ouf=x%10+'0';
		++ouf;
	}
	inout& operator <<(int a){
		
		if(a<0){*ouf='-';++ouf;a=-a;}
		writeint(a);
		return *this;
	}
	static const int sz=7;
	inout& operator <<(char a){
		*ouf=a;++ouf;
		return *this;
	}
	inout& operator <<(char *a){
		while(*a){
			*ouf=*a;
			++ouf;
			++a;
		}
		return *this;
	}
	inout& operator <<(double a){
		if(a<-eps){*ouf='-';++ouf;a=-a;}
		writeint((int)a);
		a-=(int)a;
		*ouf='.';
		++ouf;
		up(i,1,sz){
			a=a*10;
			*ouf=(int)a+'0';
			++ouf;
			a-=(int)a;
		}
		return *this;
	}
	void out(){
		fwrite(out_buf,1,ouf-out_buf,stdout);
		ouf=out_buf;
	}
};
inout io;
template<class T>void chkmin(T &a,T b){a=a<b?a:b;}
template<class T>void chkmax(T &a,T b){a=a>b?a:b;}
char s[201010];
int fst[30],f[201010],to[201010];
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	scanf("%s",s+1);
	int n=strlen(s+1);
	for(int i=0;i<26;++i){fst[i]=n+i+1;s[n+i+1]=i+'a';f[n+i+1]=1;to[n+i+1]=0;}
	down(i,1,n){
		f[i]=0x3f3f3f3f;
		up(j,0,25){
			if(f[fst[j]]+1<f[i]){
				f[i]=f[fst[j]]+1;
				to[i]=fst[j];
			}
		}
//		debug("%c",s[i]);debug("%c",s[to[i]]);
		fst[s[i]-'a']=i;
//		debug("%d\n",f[i]);
	}
	int frst=0;
	f[0]=0x3f3f3f3f;
	up(i,0,25){
		if(!fst[i]){putchar(i+'a');putchar('\n');return 0;}
		if(f[fst[i]]<f[frst])frst=fst[i];
	}
	while(frst){
		putchar(s[frst]);
		frst=to[frst];
	}
	putchar('\n');
	return 0;
}


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

using namespace std;

const int MAXN = 100001;
const int MAXK = 101;

int N,H[MAXN],dp[MAXN];

int main(){
	#ifdef EVAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> H[i];
	}
	dp[1] = abs(H[1] - H[0]);
	for(int i = 2; i < N; i++){
		dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]),  dp[i - 2] + abs(H[i] - H[i - 2]));
	}
	cout << dp[N - 1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b,c;
  cin >> a >> b >> c;
  if((a+b)>=c){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	x := nextInt()
	a := nextInt()
	if x < a {
		_, _ = fmt.Fprint(writer, "0")
	} else {
		_, _ = fmt.Fprint(writer, "10")
	}

}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, d;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> d;
    if (n % ((2 * d) + 1) == 0)
    {
        cout << n / ((2 * d) + 1) << "\n";
        return 0;
    }
    else
        cout << n / ((2 * d) + 1) + 1 << "\n";
}

Measured memory_bytes: 256
S = input()
T = input()

string = ''

for i in range(len(S)):
    if S[i] not in string:
        S_ch = [j for j, x in enumerate(S) if x == S[i]]
        T_ch = [j for j, x in enumerate(T) if x == T[i]]
        string += S[i]
        if S_ch != T_ch:
            print('No')
            exit()

print('Yes')


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

int main() {
	int n;
	cin >> n;
	vector<int> w(n);
	for (int i = 0; i < n; i++) cin >> w[i];

	int res = 9999;
	for (int i = 0; i < n; i++) {
		int r1 = 0, r2 = 0;
		for (int j = 0; j < i; j++) r1 += w[j];
		for (int j = i; j < n; j++) r2 += w[j];
		if (res > abs(r1 - r2)) res = abs(r1 - r2);
	}
	cout << res << endl;
}

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

using namespace std;
typedef pair<int, int> P;
const int INF = (1 << 30);
int V, E, r;
int dp[100000];
struct edge{
	int to, cost;
	edge(int to,int cost=1):to(to),cost(cost){}
};
vector<edge> G[100000];



int main()
{
	 cin >> V >> E >> r;
	for (int i = 0; i < E; ++i) {
		int s, t, d;
		cin >> s >> t >> d;
		edge e(t,d);
		G[s].push_back(e);
	}
	fill(dp, dp + V, INF);
	dp[r] = 0;
	priority_queue<P, vector<P>, greater<P>> que;
	P start(0, r);
	que.push(start);
	while (!que.empty()) {
		P p = que.top(); que.pop();
		if (dp[p.second] < p.first)continue;

		int v = p.second;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (dp[e.to]>dp[v] + e.cost) {
				dp[e.to] = dp[v] + e.cost;
				que.push(P(dp[e.to], e.to));
			}
		}
	}
	for (int i = 0; i < V; i++) {
		if (dp[i] == INF)cout << "INF" << endl;
		else cout << dp[i] << endl;
	}
}

Measured memory_bytes: 11276
#include <stdio.h>

int main()
{
  int N, A[100];
  int i, j, minj, tmp, flag, counter = 0;

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

  for(i = 0; i <= N-1; i++)
    {
      flag = 0;
      minj = i;
      for(j = i; j <= N-1; j++)
	{
	  if(A[j] < A[minj])
	    {
	      minj = j;
	      flag++;
	    }
	}
      if(flag != 0)
	{
	  tmp = A[minj];
	  A[minj] = A[i];
	  A[i] = tmp;
	  counter++;
	}
    }
  for(i = 0; i < N; i++)
    {
      printf("%d", A[i]);
      if(i != N-1) printf(" ");
    }
  printf("\n");
  printf("%d\n", counter);

  return 0;
}

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

#define N 201

int main(void){
    int n, l, i, sum = 0, min = 1;
    int a[N];

    scanf("%d %d", &n, &l);

    for(i=1;i<=n;i++){
        a[i] = l + i - 1;
        sum += a[i];
    }

    for(i=1;i<n;i++){
        if(abs(a[i])>abs(a[i+1])){
            min = i+1;
        }
    }

    sum -= a[min];

    printf("%d", sum);

    return 0;
}

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

int main(){
    int S,W;
    cin >> S >> W;

    if(W>=S) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
}

Measured memory_bytes: 3624
import java.util.*;

// ARC 98-D
// https://beta.atcoder.jp/contests/arc098/tasks/arc098_b

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

		char[] s = in.next().toCharArray();
		long K = in.nextLong();
		
		char answer = '1';
		if (K < s.length) {
			boolean isAnswer1 = true;
			for (int i = 0; i < K; i++) {
				if (s[i] != '1') {
					isAnswer1 = false;
				}
			}
			if (isAnswer1) {
				System.out.println(1);
				return;
			}
		}
		
		for (int i = 0; i < s.length; i++) {
			if (s[i] != '1') {
				answer = s[i];
				break;
			}
		}
		
		System.out.println(answer);
    }
}


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

//しっかり制約確認したか?
int main()
{
    string s,t; cin >> s >> t;
    int cnt = 0;
    rep(i, s.size()){
        if(s[i] != t[i]){
            cnt++;
        }
    }
    cout << cnt << endl;

    system("pause");
}


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

int main() 
{
   char c;
   cin >> c;

   vector<char> v(5);
   v = {'a', 'i', 'u', 'e', 'o'};

   bool frag = false;
   for (int i = 0; i < 5; i++)
   {
      if (c == v.at(i))
         frag = true;
   }

   if (frag)
      cout << "vowel" << endl;
   else
      cout << "consonant" << endl;
}


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

int main() {
    string S;
    cin >> S;
    int N = S.size() + 1;
    vector<int> Left_l(N,0), Right_g(N,0);    // 左の<(less than)、右の>(greater than)
    for(int i = 1; i < N; ++i) {
        if(S[i-1] == '<') Left_l[i] = Left_l[i-1] + 1;
    }
    //cout << "step 1" << endl;
    for(int i = N-2; i >= 0; --i) {
        if(S[i] == '>') Right_g[i] = Right_g[i+1] + 1;
    }
    //cout << "step 2" << endl;
    long long res = 0LL;
    for(size_t i = 0; i < N; ++i) {
        int tmp = max(Left_l[i], Right_g[i]);
        //cout << tmp << " ";
        res += tmp;
    }
    //cout << endl;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4740
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int m,n;


bool search(int x,int y,vector<vector<char>> A,vector<vector<char>> B){
	bool flag = true;
	for(int i = x; i < m + x; i++) {
		for(int j = y; j < m + y; j++) {
			if (A[i][j] != B[i - x][j - y]){
				flag = false;
				return flag;
			}
		}
	}
	return flag;
}

int main(){
	cin >> n >> m;
	vector<vector<char>> A(n,vector<char>(n));
	vector<vector<char>> B(m,vector<char>(m));
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			cin >> A[i][j];
		}
	}
	for(int i = 0; i < m; i++) {
		for(int j = 0; j < m; j++) {
			cin >> B[i][j];
		}
	}

	for(int i = 0; i < n - m + 1; i++) {
		for(int j = 0; j < n - m + 1; j++) {
			if (A[i][j] == B[0][0]){
				if(search(i,j,A,B)){
					cout << "Yes" << endl;
					return 0;
				}
			}

		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1000000000000000000;
const char END = '\n';


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

	ll N, X, T, Ans, n;
	cin >> N >> X >> T;

	n = N / X;
	if (N%X != 0)
		n += 1;

	Ans = T * n;
	   
	cout << Ans;
	cout << END;
	return 0;
}


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

using namespace	std;

int main() {
  string S; cin>>S;
  int ans = 0;
  for(int i = 0; i < 4;	i++) {
    if(S[i] == '+') ans++;
    else ans--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var x int

	fmt.Scanf("%d", &x)

	for i := -118; i <= 119; i++ {
		for j := -119; j <= 118; j++ {
			if x == int(math.Pow(float64(i), 5)-math.Pow(float64(j), 5)) {
				fmt.Print(i)
				fmt.Print(" ")
				fmt.Print(j)
				return
			}
		}
	}
}


Measured memory_bytes: 1820
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String s = sc.nextLine();
        char[] p = {'A', 'B', 'C'};
        int idx = 0;
        int count = 0;

        for (int i = 0; i < n; i++) {
            if (s.charAt(i) != p[idx]) {
                idx = s.charAt(i) == p[0] ? 1 : 0;
            }
            else idx++;
            if (idx == 3) {
                idx = 0;
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = ;
const long long INF_LL = 1e18+3; const int INF_int = 1e9+3;
#define ll long long
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto itr = a.begin();itr!=a.end();itr++) cout << *itr << " ";cout << endl;
//@brief nCk (O(k))
template <typename T>
T combi_simple(T n,T k,long long MOD = MOD){
    k = min(n-k,k);
    T ret = 1;
    for(T i = n;i>n-k;i--) ret*=i;
    for(T i=1;i<=k;i++) ret/=i;
    return ret;
}
int main(){
    string s;ll k;
    cin >> s >> k;
    ll ans = 0;
    ll n = s.size();
    auto f = [](string s,int k){int t = 0;rep(i,s.size()) if(s[i]!='0') t++;if(t>=k) return true;else return false;};
    if(f(s,k)) ans++;
    rep(i,n){
        if(k==0) break;
        if((n-i)>=k) ans+=max(0,(s[i]-'0')-1)*pow(9,k-1)*combi_simple(n-1-i,k-1);
        if((n-1-i)>=k && s[i]!='0')ans+=pow(9,k)*combi_simple(n-i-1,k);
        if(s[i]!='0') k--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<queue>
#include<set>
#include<string>
#include<sstream>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

ll Pow_mod(ll a, ll b, ll c){
    ll ans = 1;
    a %= c;
    while (b){
        if (b & 1) ans = (ans * a) % c;
        a = (a * a) % c;
        b >>= 1;
    }
    return (ans % c);
}

int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a % b);
}

ll s;

int main(){
    scanf("%lld", &s);
    ll x1, y1, x2, y2, x3, y3;
    const ll tmp = 1e9;
    x1 = 0, y1 = 0;
    x2 = tmp, y2 = 1;
    y3 = s / tmp;
    if (s % tmp) y3 ++;
    x3 = y3 * tmp - s;
    printf("%lld %lld %lld %lld %lld %lld\n", x1, y1, x2, y2, x3, y3);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String s;
    s=sc.next();
    String d[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for(int i=0;i<7;i++){
      if(d[i].equals(s)){
        System.out.println(7-i);
        break;
      }
    }
  }
}


Measured memory_bytes: 23764
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 配列数 - 取得
	int liACnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &liACnt);

	// 数列数 - 取得
	int liCnt = 1;
	int liPre = 0;
	int liUp = 0;
	for (i = 0; i < liACnt; i++) {
		int liVal;
		fscanf(szpFpI, "%d", &liVal);

		// １つ前と比較
		if (i > 0) {
			int liDF = liVal - liPre;
			if (liDF > 0) {
				if (liUp < 0) {
					liCnt++;
					liUp = 0;
				}
				else {
					liUp = liDF;
				}
			}
			else if (liDF < 0) {
				if (liUp > 0) {
					liCnt++;
					liUp = 0;
				}
				else {
					liUp = liDF;
				}
			}
		}

		// １つ前
		liPre = liVal;
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	return liCnt;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// １行出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int mn = 1005;
int a[mn];
int main()
{
    int n, ans = 0;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    for(int i = 1; i <= n; i++)
        for(int j = i + 1; j <= n; j++)
            ans += a[i] * a[j];
    printf("%d\n", ans);
}


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

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

const ll MAX=1<<18;
const ll INF=0x3f3f3f3f3f3f3f;
const ll MOD=1e9+7;
ll a[MAX],ans,n,t;
int main(){
    scanf("%lld%lld",&n,&t);
    for(ll i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    a[n]=INF;
    for(ll i=0;i<n;i++){
        ans+=min(a[i+1]-a[i],t);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
#![allow(dead_code)]

use std::io;
fn main() {
    solve_a();
}

fn solve_a() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    for (_i, c) in line.trim().chars().enumerate() {
        if c.is_alphabetic() {
            if c.is_uppercase() {
                print!("{}", c.to_lowercase());
            } else {
                print!("{}", c.to_uppercase());
            }
        } else {
            print!("{}", c);
        }
    }
    println!("");
}



Measured memory_bytes: 5060
#include <iostream>
#include <algorithm>
#include<vector>

using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int a, b;
	while (1)
	{
		cin >> a >> b;
		if (a == 0 && b == 0) break;
		cout << min(a, b) << " " << max(a, b) << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
[N,K] = list(map(int,input().split()))
[R,S,P] = list(map(int,input().split()))
T = input()
H = []
output = 0
for i in range(N):
    if T[i]=="r":
        H.append("P")
        output += P
    elif T[i]=="s":
        H.append("R")
        output += R
    elif T[i]=="p":
        H.append("S")
        output += S
for i in range(0,N-K):
    if H[i]==H[i+K]:
        if H[i]=="R":
            output += -1*R
            H[i+K] = str(i)
        elif H[i]=="S":
            output += -1*S
            H[i+K] = str(i)
        elif H[i]=="P":
            output += -1*P
            H[i+K] = str(i)

print(output)

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

int main()
{
     ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     
     string s,t;
     
     cin>>s>>t;
     
     long long int cnt=0;
     
     for(int i=0;i<s.size();i++)
     {
         if(s[i]!=t[i])
         cnt++;
     }
     
     cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3796
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

// 最大公約数
long long gcd(long long a, long long b){
    while(b != 0){
        long long tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

// 最小公倍数
long long lcm(long long a, long long b){
    return a / gcd(a, b) * b;
}

int main()
{
    const int prime[] = {13, 17, 19, 23};

    long long a = 1;
    for(int i=1; i<=24; ++i){
        if(find(prime, prime+4, i) == prime+4)
            a = lcm(a, i);
    }

    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<vector<int> > x(25, vector<int>(24, 0));
        for(int i=0; i<n; ++i){
            int d, t;
            cin >> d >> t;
            for(int j=0; j<d; ++j){
                int q;
                cin >> q;
                x[d][(t-j+d)%d] += q;
            }
        }

        for(int i=0; i<4; ++i){
            int d = prime[i];
            x[d].assign(d, *max_element(x[d].begin(), x[d].end()));
        }

        int ret = 0;
        for(int i=0; i<a; ++i){
            int sum = 0;
            for(int j=1; j<=24; ++j)
                sum += x[j][i%j];
            ret = max(ret, sum);
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 1216
#include <functional>
#include <list>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <deque>
#include <stack>
#include <cassert>
using namespace std;
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define ALL(x) (x).begin(),(x).end()
#define CASET2 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d:\n", case_n++) : 0), ___T-- > 0)
#define CASET1 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d: ", case_n++) : 0), ___T-- > 0)
#define CASET int ___T; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define REP(i,n) for(int i=0;i<int(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=int(b);i++)
#define PER1(i,a,b) for(int i=(a);i>=(b);i--)
#define REPL(i,x) for(int i=0;x[i];i++)
#define PER(i,n) for(int i=(n)-1;i>=0;i--)
#define RI1(x) scanf("%d",&x)
#define RI2(x,y) RI1(x), RI1(y)
#define RI3(x,y...) RI1(x), RI2(y)
#define RI4(x,y...) RI1(x), RI3(y)
#define RI5(x,y...) RI1(x), RI4(y)
#define RI6(x,y...) RI1(x), RI5(y)
#define GET_MACRO(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define RI(argv...) GET_MACRO(argv, RI6, RI5, RI4, RI3, RI2, RI1)(argv)
#define DRI(argv...) int argv;RI(argv)
#define WRI(argv...) while (RI(argv) != EOF)
#define DWRI(x...) int x; WRI(x)
#define RS(x) scanf("%s",x)
#define MP make_pair
#define PB push_back
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define X first
#define Y second
#define V(x) vector<x >

typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

void print(int i) { printf("%d", i); }
void print(LL i);
template<class T> void PI(T i) { print(i); puts(""); }
template<class T> void PIS(T i) { print(i); printf(" "); }

template<class T>
void PV(T const &v, int N) {
    REP(i, N) {
        print(v[i]);
        printf("%c", i == N-1 ? '\n' : ' ');
    }
}

template<class T> void PV(T const &v) { PV(v, SZ(v)); }

template<class T, class S> bool has_bit(T mask, S i) { return (mask >> i) & 1; }
long long shift(int i) { return 1ll << i; }

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
int popcount(int x) { return __builtin_popcount(x); } 
int popcount(long long x) { return __builtin_popcountll(x); } 

#include <unordered_set>
#include <unordered_map>
#define EB emplace_back
#define RL(x) scanf("%lld", &(x))
#define PL(x) printf("%lld\n", x)
#define DRL(x) LL x; RL(x)

int main() {
    DRI(N, K);
    REP(i, N) {
        DRI(a);
    }
    PI((N-1 + K - 2) / (K-1));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    string t;
    cin>>t;
    bool p=false;
    for(ll i=0; i<t.size(); i++){
        if(!p&&t[i]=='?'){
            t[i]='D';
        }else if(i-1>=0&&t[i-1]=='P'&&t[i]=='?'){
            t[i]='D';
        }else if(i-1>=0&&i+1<t.size()&&t[i-1]=='D'&&t[i]=='?'&&(t[i+1]=='?'||t[i+1]=='D')){
            t[i]='P';
        }else if(p&&t[i]=='?'){
            t[i]='D';
        }else if(!p&&t[i]=='?'){
            t[i]='P';
            p=true;
        }
        if(t[i]=='P') p=true;
    }
    cout<<t<<endl;
}

Measured memory_bytes: 3752
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = INT()
print(arr[n - 1])

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

int main()
{
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    int ans = 0;
    if (x==w/2 && y==h/2) ans = 1;
    cout << fixed << setprecision(10);
    cout << (w*h)/2 << " " << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char x[200010],y[200010];
long n,q,c=-1,d;
string s;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>q>>s;
    d=n;
    for(int i=0; i<q; i++)
        cin>>x[i]>>y[i];
    for(int i=q-1; i>=0; i--)
    {
        if(x[i]==s[c+1]&&y[i]=='L')
            c++;
        if(x[i]==s[d-1]&&y[i]=='R')
            d--;
        if(x[i]==s[c]&&y[i]=='R')
            c--;
        if(x[i]==s[d]&&y[i]=='L')
            d++;
    }
    cout<<max(0,(int)(d-c-1))<<endl;
    return 0;
}


Measured memory_bytes: 976
import sys
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
links = [[] for _ in range(N+1)]
for _ in range(M):
    s, t = map(int, input().split())
    links[s].append(t)

dp = [-1 for _ in range(N+1)]
def search(i):
    if dp[i] != -1:
        return dp[i]
    
    paths = 0
    for t in links[i]:
        paths = max(paths, search(t)+1)
    
    dp[i] = paths
    return paths

for i in range(1, N+1):
    search(i)

print(max(dp))

Measured memory_bytes: 59092
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

typedef long long LL;

int N,M;
LL dp[333][333][333];
LL po[333];
LL ans;
const LL mod = 1e9 + 7;

int main(){
	scanf("%d%d" , &N , &M);
	if(N > M){
		printf("0\n");
		return 0;
	}
	po[0] = 1;
	repp(i,0,M){
		po[i+1] = po[i] * N % mod;
	}
	dp[1][1][1] = dp[0][1][1] = 1;
	repp(i,1,M+1){
		repp(j,1,N+1){
			repp(k,1,j+1){
				(dp[i][j][k] += dp[i-1][j][k] * (j-k) + dp[i-1][j-1][k] * (N-j+1)) %= mod;
				(dp[i+1][j][j] += dp[i][j][k] * k) %= mod;
			}
		}
	}
	printf("%lld\n" , dp[M][N][N]);
	return 0;
}


Measured memory_bytes: 236160
using System;

class P
{
public static void Main()
{
            //????????????????????????
            string x = Console.ReadLine();

            //?????????????????????????????????
            var split = x.Split(' ');

            int a = Int32.Parse(split[0]);
            int b = Int32.Parse(split[1]);

            //?????¶???????????¨???
            if (a < b)
            {
                Console.WriteLine("a < b");
            }
            else if(a > b)
            {
                Console.WriteLine("a > b");
            }
            else
            {
                Console.WriteLine("a == b");
            }
}
}

Measured memory_bytes: 8864
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

int main(){
	double X,T;
	cin>>X>>T;
	cout<<X/T<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

const ll MOD = 1000 * 1000 *1000 + 7 ;
inline void chadd(ll &a, const ll b) { a = (a + b) % MOD;}
inline ll add(const ll a, const ll b){ return (a + b) %  MOD;}
inline void chsub(ll &a, const ll b) { a = (a - b + MOD) % MOD;}
inline ll sub(const ll a, const ll b){ return (a - b + MOD) % MOD; }
inline void chmul(ll &a, const ll b) { a = (a * b) %  MOD;}
inline ll mul(const ll a, const ll b){ return (a * b) %  MOD;}

const int MOD_TABLE_SIZE = 1000000 + 10;
ll inv[MOD_TABLE_SIZE];
ll fac[MOD_TABLE_SIZE];
ll facinv[MOD_TABLE_SIZE];

void mod_table_init() {
  inv[1] = 1;
  for(int i = 2; i < MOD_TABLE_SIZE; i++) {
    inv[i] = MOD - (MOD / i) * inv[(int)MOD % i] % MOD;
  }
  fac[0] = facinv[0] = 1;
  for(int i = 1; i < MOD_TABLE_SIZE; i++) {
    fac[i] = (fac[i-1] * (ll)i) % MOD;
    facinv[i] = (facinv[i-1] * inv[i]) % MOD;
  }
}

inline ll P(int a, int b) {
  if(a<b) return 0LL;
  return fac[a] *  facinv[a-b] % MOD;
}

inline ll C(int a, int b) {
  if(a<b) return 0LL;
  return (fac[a] * facinv[b] % MOD) * facinv[a-b] % MOD;
}

inline ll H(int a, int b) {
  return C(a+b-1,b);
}


void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

ll solve(const int X, const int Y) {
  int sum = X + Y;
  if(sum % 3 != 0) return 0;
  int A = sum / 3;
  int B = Y - A;
  if(B < 0) return 0;
  if(B > A) return 0;
  mod_table_init();
  ll ans = 1;
  //  cout << A << "," << B << endl;
  ans = C(A, B);
  return ans;
}

int main() {
  int X, Y; cin>>X>>Y;
  ll ans = solve(X, Y);
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int x;

signed main()
{
    cin>>x;

    int cnt = x/100;
    int amari = x%100;
    
    int x5 = amari/5;
    int x5a = amari%5;

    if(x5a!=0){
        x5 +=1;
    }

if(x5<=cnt){
    cout<<1<<endl;
}
else{
    cout<<0<<endl;
}


    

    return 0;
}


Measured memory_bytes: 384
D, G = map(int, input().split())
p = [0]*D
c = [0]*D
for d in range(D):
    p[d], c[d] = map(int, input().split())

time_list = []
for i in range(1<<D):
    point = 0
    time = 0
    output = []
    #for j in range(D): 
        #print(i,j+1,bin(i>>j))
        #if ((i >> j) & 1) == 1: #ある数と1とのANDを取ることは，その数の右端のbitが0か1を調べることに等しい．iの右からj+1番目のbitが1かどうかを確認している．
            #output.append(A[j])
    #print(output)
    for d in range(D):
        if ((i>>d) & 1) == 1:
            point += 100*(d+1)* p[d] + c[d]
            time += p[d]
    if point < G:
        # iで一番左側にある0を探す。
        for d in range(D)[::-1]:
            if ((i>>d) & 1) == 0: # and論理積は1==1以外はすべてfalse
                for k in range(p[d]):
                    if point < G:
                        point += 100*(d+1) 
                        time += 1
                    else: break
                break
            else: continue
    if point >= G:
        time_list.append(time)
print(min(time_list))

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

int cnt = 0;
int m = 20;
int G[20] = {};
void insertionsort(int A[], int n, int g){
    for(int i = g; i < n; i++){
        int v = A[i];
        int j = i-g;
        while(j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j = j-g;
            cnt++;
        }
        A[j+g] = v;
    }
}
void shellsort(int A[], int n){
    for (int i = m-1; i >= 0; i--){
       if (i == m-1) G[i] = 1;
       else G[i] = G[i+1]*3 + 1;
    }
    for (int i = 0; i < m; i++){
        insertionsort(A, n, G[i]);
    }
}
int main(){
    int n;
    cin >> n;
    int A[n];
    for (int i = 0; i < n; i++){
        cin >> A[i];
    }
    shellsort(A, n);
    int mtrue = 0;
    for (int i = 0; i < m; i++){
        if (G[i] <= n) mtrue++;
    }
    cout << mtrue << endl;
    for (int i = 0; i < m; i++){
        if (G[i] <= n) cout << G[i] << " ";
    }
    cout << endl << cnt << endl;
    for (int i = 0; i < n; i++){
        cout << A[i] << endl;
    }

    return 0;

}


Measured memory_bytes: 6980
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

using P = pair<Int, Int>;
using PP = pair<P, Int>;
Int n, m;
vector<PP> v;
vector<Int> d;

Int getmin(Int p){
	Int ret = 1e18;
	for(Int i=p; i>0; i-=i&-i) ret = min(ret, d[i]);
	return ret;
}
void update(Int p, Int q){
	for(Int i=p; i<=n; i+=i&-i) d[i] = min(d[i], q);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	v.resize(m);
	for(Int i=0; i<m; ++i){
		Int l, r, c; cin >> l >> r >> c;
		v[i] = PP(P(l, r), c);
	}
	sort(v.rbegin(), v.rend());
	d.resize(n+1, 1e18);
	d[n] = 0;
	for(Int i=0; i<m; ++i){
		Int l = v[i].first.first;
		Int r = v[i].first.second;
		Int c = v[i].second;
		Int dr = getmin(r);
		update(l, dr+c);
	}
	if(d[1] == 1e18) cout << -1 << "\n";
	else cout << d[1] << "\n";
}

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

long long ans,sum[100010],a[100010];
map<long long,long long> m;
long long n,k;

int main()
{
	scanf("%lld%lld",&n,&k);
	m[0]=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		sum[i]=sum[i-1]+a[i];
		ans+=m[sum[i]%k];
		m[sum[i]%k]++;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 5760
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: u64, k: u64
    }
    println!("{}", if k == 1 {0} else {n-k});
}

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

int main() {
  string S; cin >> S;
  int n = S.size();
  int ans = 10000;
  for (int i = 0; i < n -2; i++) {
    int a = S.at(i) - '0';
    int b = S.at(i + 1) - '0';
    int c = S.at(i + 2) - '0';
    int x = a * 100 + b * 10 + c;
    ans = min(ans, abs(753 - x));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
c_kokunai = 0
c_kaigai = 0
s = input()
for i in range(n):
    if s[i] == "a" and c_kokunai + c_kaigai < a+b:
        print("Yes")
        c_kokunai += 1
    elif s[i] == "b" and c_kokunai + c_kaigai < a+b and c_kaigai < b:
        print("Yes")
        c_kaigai += 1
    else:
        print("No")

Measured memory_bytes: 4016
n,m = map(int,input().split())
ls = [[] for _ in range(n+1)]
di = []
for i in range(m):
    a,b = map(int,input().split())
    ls[a].append([b,i+1])
for j in range(n+1):
    if ls[j] != []:
        ls[j].sort(key=lambda x :x[0])
        for k in range(len(ls[j])):
            di.append([ls[j][k][1],str(10**12+j*10**6+k+1)[1:]])
di.sort(key=lambda x :x[0])
for l in range(m):
    print(di[l][1])

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a;
  cin >> a;
  int b = a + a * a + a* a* a;
  cout << b << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <climits>

int main(int argc, char **argv){
	int n = 0;
	long min = INT_MAX;
	long max = -INT_MAX;
	long sum = 0;
	
	std::cin >> n;

	for(int i = 0; i < n; i++){
		long c = 0;

		std::cin >> c;

		sum += c;
		min = std::min(c, min);
		max = std::max(c, max);
	}

	std::cout << min << " " << max << " " << sum << std::endl;

	return 0;

}

Measured memory_bytes: 3080
a = int(input());
b = [];
c = 0;
for i in range(a+1):
    if i%3==0 and i%5==0:
        b.append("FizzBuzz");
    elif i%3==0 and i%5!=0:
        b.append("Fizz");
    elif i%3!=0 and i%5==0:
        b.append("Buzz");
    else:
        c = c+i;
print(c);



Measured memory_bytes: 12580
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

ll N, K;
vector<ll> A(200100);

bool isOK(ll len){
	ll cut_cnt = 0LL;
	rep(i,N){
		if(len >= A[i])continue;
		else cut_cnt += A[i]/len + (A[i]%len != 0LL) -1LL;
	}
	//printf("[len, cut_cnt -> %d, %d]\n", len, cut_cnt);
	if(cut_cnt <= K)return true;
	else return false;
}

ll binary_search(){
	ll ng = 0LL;
	ll ok = 10100000000;
	while(abs(ok-ng) > 1LL){
		ll mid = (ok + ng)/2LL;
		if(isOK(mid))ok = mid;
		else ng = mid;
	}
	return ok;
}

int main(){
	cin >> N >> K;
	A.resize(N);
	rep(i,N)cin >> A[i];
	cout << binary_search() << endl;
	return 0;
}


Measured memory_bytes: 4628
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    string s; cin >> s;
    if (s == "A") cout << "T" << endl;
    else if (s == "T") cout << "A" << endl;
    else if (s == "G") cout << "C" << endl;
    else if (s == "C") cout << "G" << endl;
}

Measured memory_bytes: 3532
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public  static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    }
}



Measured memory_bytes: 33348
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.flush();
	map<char,int>  mp;
    mp['a'] = 0;
    mp['b'] = 0;
    mp['c'] = 0;
    
    char c;
    while(cin >> c)
      mp[c] = 1;
  	
    for(auto &k: mp)
       if(k.second == 0)
       {
         cout<<"No";return 0;
       }
   
   cout<<"Yes";

	return 0;
	// BYE BYE
}


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

int main() {
  vector<int>data(3);
  for(int i = 0;i < 3;i++){
    cin >> data[i];
  }
  sort(data.begin(),data.end());
  for(int i = 0;i < 3;i++){
    cout << data[i];
    if(i != 2){
      cout << " ";
    }
  }
  cout << "" << endl;
}



Measured memory_bytes: 3160