akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define For(i, a, b)  for(int i = a, _b = b; i <= _b; ++i)
#define Ford(i, a, b) for(int i = a, _b = b; i >= _b; --i)
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Print(x)      cerr << #x << "is " << x << '\n';
#define pb            push_back
#define X             first
#define Y             second
//#define Karma

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
typedef pair<ll, int> plli;
const int N = 60;
const ll mod = 1e9 + 7;

struct Matrix
{
    int n;
    ll m[N][N];
} org;

Matrix Mul(const Matrix& x, const Matrix& y)
{
    Matrix res;
    res.n = x.n;
    For(i, 1, x.n)
    {
        For(j, 1, y.n)
        {
            res.m[i][j] = 0;
            For(k, 1, x.n)
            {
                res.m[i][j] += (x.m[i][k] * y.m[k][j]) % mod;
                if(res.m[i][j] >= mod) res.m[i][j] -= mod;
            }
        }
    }
    return res;
}

Matrix Pow(ll y)
{
     Matrix res;
     res.n = org.n;
     For(i, 1, org.n)
     {
        For(j, 1, org.n) res.m[i][j] = 0;
        res.m[i][i] = 1;
     }
     for(ll i = y; i; i >>= 1)
     {
         if(i & 1) res = Mul(res, org);
         org = Mul(org, org);
     }
     return res;
}

int n;
ll k;

void Enter()
{
     Cin(n, k);
     org.n = n;
     For(i, 1, n)
     {
         For(j, 1, n) Cin(org.m[i][j]);
     }
     Matrix res = Pow(k);
     ll ans = 0;
     For(i, 1, n)
     {
         For(j, 1, n) {ans += res.m[i][j]; ans %= mod;}
     }
     cout << ans;
}

void Solve()
{

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef Karma
    freopen(FileName".inp", "r", stdin);
    freopen(FileName".out", "w", stdout);
#endif // Karma

    Enter();
    Solve();

    return 0;
}


Measured memory_bytes: 384
s = input()
hmp = 0
ans = 0
for i in s:
    if i == 'g' and hmp > 0:
        hmp -= 1
        ans += 1
    elif i == 'g':
        hmp += 1
    elif hmp > 0:
        hmp -= 1
    else:
        hmp += 1
        ans -= 1
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;


template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
int main(){
    ll n,m; cin >> n >> m;  
    vector<vector<ll>> table(n,vector<ll>(m));
    rep(i,n)rep(j,m){
        cin >> table[i][j];
        table[i][j]--;
    }
    Pll ans = {INF,-1};
    vector<ll> index(n,0), num(m,0);
    const int m_max = 330;
    bitset<m_max> bs(0);
    bs = ~bs;
    // debug(bs);
    rep(i,n){
        num[table[i][0]]++;
    }
    rep(i,m){
        Pll temp = {0,-1};
        rep(j,m)chmax(temp, {num[j],j});
        // // debug(temp.first);debug(temp.second);
        bs[temp.second] = 0;
        num[temp.second] = 0;
        rep(j,n){
            bool is_update = false;
            while(bs[table[j][index[j]]] == 0 && index[j] < m){
                index[j]++;
                is_update = true;
            }
            if(is_update && index[j] < m)num[table[j][index[j]]]++;
            // debug(index[j]);
        }
        chmin(ans, temp);
    }

    cout << ans.first << endl;
}

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = (int)Math.ceil((double)(b-1)/(a-1));
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};



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

    ll n;
    cin >> n;
    vector<ll> a(1000000,0);
    ll ans = 0;
    rep(i,n){
        ll x;
        cin >> x;
        a[x]++;
        ans += x;
    }
    ll q;
    cin >> q;
    rep(i,q){   
        ll b,c;
        cin >> b >> c;
        ll tmp = a[b];
        a[b] = 0;
        ans -= b*tmp;
        a[c] += tmp;
        ans += c*tmp;
        cout << ans << endl;
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 11096
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string.h>
#include <stdlib.h>

using namespace std;
// vector push_back push front top empty pop make_pair long long insert begin end  
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair <int,int> > vpi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define B begin()
#define RB rbegin()
#define E end()
#define RE rend()
#define Z size()
#define REP(i,a,b) for (int i = a; i < b; i++)
#define L length()
#define show(a) cerr << " *** " << a << endl;
#define show1(a) cerr << " /// " << a << endl;
#define valid(a,b,c) (a >= b && a < c ? 1 : 0)
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int mod = (int)1e9 + 7;
void ads(ll &a, ll b){a += b;if (a >= mod)a -= mod;}
void mis(ll &a, ll b){a -= b;if (a >= mod)a -= mod; if (a < 0)a += mod;}
ll gcd(ll a, ll b) {return (b==0? a:gcd(b,a%b));}
ll egcd(ll a, ll b, ll & x, ll & y) {if (a == 0){x = 0;y = 1;return b;}ll x1, y1;ll d = egcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
ll mbinp(ll a, ll b){a %= mod;if (b == 0)return 1;ll ans = mbinp(a, b/2);ll tmp = (ans * ans) % mod;if (b % 2)return ((tmp * a) % mod);return ((tmp) % mod);}
ll binp(ll a, ll b){if (b == 0)return 1;ll ans = binp(a, b/2);ll tmp = (ans * ans);if (b % 2)return ((tmp * a));return ((tmp));}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	vector <vi> all(n,vi(n));
	REP(i,0,n)
	{
		REP(j,0,n)
			cin >> all[i][j];
	}
	vll dp((1 << n), 0);
	dp[0] = 1;
	REP(mask, 0,(1 <<n)-1)
	{
		int a = __builtin_popcount(mask);
		REP(j,0,n)
		{
			if (all[a][j] == 1 && !(mask&(1<<j)))
			{
				int m2 = mask ^ (1<<j);
				ads(dp[m2],dp[mask]);
			}
		}
	}
	cout << dp[(1<<n)-1];
}


Measured memory_bytes: 16640
package main

import (
	"fmt"
	"math"
)

func main() {
	min := math.MaxInt64
	max := math.MaxInt64 * -1
	sum := 0

	n := 0
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		var t int
		fmt.Scan(&t)

		sum += t
		if min > t {
			min = t
		}
		if max < t {
			max = t
		}
	}
	fmt.Println(min, max, sum)
}



Measured memory_bytes: 1776
input()
l = list(map(int,input().split()))
l.sort()
ans = 1000000
n_ans = 0
for i in range(l[0],l[len(l)-1]+1):
  for j in range(len(l)):
    n_ans += (l[j]-i) ** 2
  if n_ans <= ans:
    ans = n_ans
    n_ans = 0
  else:
    n_ans = 0
print(ans)

Measured memory_bytes: 9116
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, M, Q;
    scan(N, M, Q);
    auto T = new long[][](N + 1, N + 1);
    foreach (_; 0 .. M)
    {
        long L, R;
        scan(L, R);
        T[L][R]++;
    }
    foreach (i; 0 .. N)
        T[i + 1][] += T[i][];
    foreach (i; 0 .. N)
        foreach (j; 0 .. N)
            T[i + 1][j + 1] += T[i + 1][j];
    foreach (_; 0 .. Q)
    {
        long p, q;
        scan(p, q);
        writeln(T[q][q] - T[q][p - 1] - T[p - 1][q] + T[p - 1][p - 1]);
    }
}


Measured memory_bytes: 5628
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vector<ll> a(3*n);
  rep(i,3*n) cin >> a[i];

  priority_queue<ll,vector<ll>,greater<ll>> q;
  vector<ll> left(n+1);
  ll sum = 0;
  rep(i,n){
    sum += a[i];
    q.push(a[i]);
  }
  left[0] = sum;
  for(int i = n; i < 2*n; i++){
    sum += a[i];
    q.push(a[i]);
    sum -= q.top(); q.pop();
    left[i-n+1] = sum;
  }


  priority_queue<ll> q2;
  vector<ll> right(n+1);
  ll sum2 = 0;
  for(int i = n*3-1; i >= n*2; i--){
    sum2 += a[i];
    q2.push(a[i]);
  }
  right[n] = sum2;
  for(int i = n*2-1; i >= n; i--){
    sum2 += a[i];
    q2.push(a[i]);
    sum2 -= q2.top(); q2.pop();
    right[i-n] = sum2;
  }
  ll ans = INF * -1;
  rep(i,n+1) chmax(ans, left[i]-right[i]);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6516
#include<stdio.h>

int main(){
	int i,rail[10],ac;

	for(i=0;i<10;i++) rail[i]=0;

	i=0;
	while(scanf("%d",&ac)!=EOF){
		if(ac==0){
			printf("%d\n",rail[--i]);
			rail[i]=0;
		}
		else{
			rail[i]=ac;
			i++;
		}

	}


	return 0;
}

Measured memory_bytes: 596
n = int(input())
button = [int(input()) for i in range(n)]

flag = False
push = button[0]
next_b = button[push-1]
cnt = 0
for i in range(n):
    cnt += 1
    if push == 2:
        flag = True
        break
    push = button[push-1]
    next_b = button[push-1]

if flag:
    print(cnt)
else:
    print(-1)

Measured memory_bytes: 7084
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9 + 7;
pair<ll, ll>s4[4] = {{ -1, 0}, {1, 0}, {0, -1}, {0, 1}};
pair<ll, ll>s8[8] = {{ -1, -1}, { -1, 0}, { -1, 1}, {0, -1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}};

void judge() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve() {
    ll n;
    cin >> n;
    string s[n];
    int a = 0, b = 0, c = 0, d = 0;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        if (s[i] == "AC")
            a++;
        else if (s[i] == "WA")
            b++;
        else if (s[i] == "TLE")
            c++;
        else
            d++;
    }
    cout << "AC x " << a << nl;
    cout << "WA x " << b << nl;
    cout << "TLE x " << c << nl;
    cout << "RE x " << d << nl;

}

signed main() {
    judge();
    boost;
    solve();
}


Measured memory_bytes: 6780
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <cstring>
#include <ctime>
#include <map>
#include <algorithm>
#include <cmath>
#define MAXN 100005
#define eps 1e-8
//#define ivorysi
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long int64;
typedef double db;
int N;
struct node {
	int to,next;
}E[MAXN * 2];
int head[MAXN],sumE,sizW[MAXN];
int F[MAXN],G[MAXN],H[MAXN],ans,son[MAXN],rt,fa[MAXN],Ah[MAXN];
char c[MAXN];
void add(int u,int v) {
	E[++sumE].to = v;
	E[sumE].next = head[u];
	head[u] = sumE;
}
void addtwo(int u,int v) {
	add(u,v);add(v,u);
}
void dfs(int u) {
	if(c[u] == 'W') sizW[u] = 1;
	else sizW[u] = 0;
	for(int i = head[u] ; i ; i = E[i].next) {
		int v = E[i].to;
		if(v != fa[u]) {
			fa[v] = u;
			dfs(v);
			sizW[u] += sizW[v];
		}
	}
}
void dfs1(int u,int fa) {
	int Sum = 0;
	for(int i = head[u] ; i ; i = E[i].next) {
		int v = E[i].to;
		if(v != fa && sizW[v]) {
			dfs1(v,u);
			++son[u];
			F[u] += F[v];
			Sum += F[v];
		}
	}
	if(!son[u] && c[u] == 'W') {
		G[u] = F[u] = 1;return;
	}
	F[u] += son[u] + 1;
	if(c[u] == 'W') F[u] += ((son[u] + 1) ^ 1) & 1;
	else F[u] += (son[u] + 1 & 1);
	G[u] = Sum;
	for(int i = head[u] ; i ; i = E[i].next) {
		int v = E[i].to;
		if(v != fa && sizW[v]) {
			G[u] = min(G[u],Sum - F[v] + G[v]);
		}
	}
	G[u] += son[u];
	if(c[u] == 'W') G[u] += (son[u] ^ 1) & 1;
	else G[u] += son[u] & 1;
	G[u] = min(G[u],F[u]);
	H[u] = 0x7fffffff;
	if(son[u] != 1) {
		
		pii t = mp(0,0);
		for(int i = head[u] ; i ; i = E[i].next) {
			int v = E[i].to;
			if(v != fa && sizW[v]) {
				if(F[v] - G[v] > t.se) t.se = F[v] - G[v];
				if(t.se > t.fi) swap(t.se,t.fi);
			}
		}
		int tmp = c[u] == 'W' ? ((son[u] - 1) ^ 1) & 1 : (son[u] - 1) & 1;
		H[u] = Sum - t.fi - t.se + tmp + son[u] - 1;
		Ah[u] = tmp;
	}
	for(int i = head[u] ; i ; i = E[i].next) {
		int v = E[i].to;
		if(v != fa && sizW[v]) {
			int tmp = Sum - F[v] + H[v] + 1 - Ah[v] + (Ah[v] ^ 1) + son[u];
			int t = c[u] == 'W' ? (son[u] ^ 1) & 1 : son[u] & 1;
			if(tmp + t < H[u]) {
				H[u] = tmp + t;Ah[u] = t;
			}
		}
	}
}
void Init() {
	scanf("%d",&N);
	int u,v;
	for(int i = 1 ; i < N ; ++i) {
		scanf("%d%d",&u,&v);
		addtwo(u,v);
	}
	scanf("%s",c + 1);
	dfs(1);
	rt = 1;
	for(int i = 1 ; i <= N ; ++i) {
		int cnt = 0;
		if(sizW[i] != sizW[1]) ++cnt;
		for(int j = head[i] ; j ; j = E[j].next) {
			int v = E[j].to;
			if(v != fa[i] && sizW[v]) ++cnt;
		}
		if(cnt >= 2) {rt = i;break;}
	}
	if(rt != 1) {
		fa[rt] = 0;
		dfs(rt);
	}
}
void Solve() {
	ans = 0x7fffffff;
	dfs1(rt,0);
	if(sizW[rt] == 0) ans = 0;
	else if(sizW[rt] == 1) ans = 1;
	else {
		for(int i = 1 ; i <= N ; ++i) {
			if(sizW[i] == sizW[rt]) {
				ans = min(ans,G[i]);
				ans = min(ans,F[i]);
				ans = min(ans,H[i]);
			}
		}
	}
	printf("%d\n",ans);
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Init();
	Solve();
	return 0;
}

Measured memory_bytes: 10624
N, M = map(int, raw_input().split())
X = map(int, raw_input().split())
X.sort()
diff_X = [X[i + 1] - X[i] for i in range(M - 1)]
diff_X.sort()
if M > N:
    print sum(diff_X[:M - N])
else:
    print 0

Measured memory_bytes: 11276
#include<stdio.h>

int main(){
	int i,j,k,count=0,max;
	char S[300],A[300];
	scanf("%s",S);
	for(i=0;S[i]!='\0';i++){
		count++;
	}
	count--;
	for(i=0;i<count/2;i++){
		for(j=0;j<=i;j++){
			A[j]=S[i+j+1];
		}
		for(k=0;k<=i;k++){
			if(A[k]!=S[k]){
				break;
			}
		}
		if(k-1==i){
			max=k*2;
		}
	
	}
	printf("%d\n",max);
	return 0;
	}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 100005;

int N, M;
string S;
int preS[MAX_N];

vector<int> ans;

signed main()
{
  cin >> N >> M;
  cin >> S;
  N++;

  reverse(begin(S), end(S));
  
  int preN = 0;
  FOR(n,1,N) {
    if(S[n] == '0') {
      preN = n;
    }
    preS[n] = preN;
  }

  int pos = 0;
  while(pos < N-1) {
    int next = preS[min(N-1, pos+M)];
    if(next == pos) {
      cout << -1 << endl;
      return 0;
    }
    ans.push_back(next - pos);
    pos = next;
  }

  reverse(begin(ans), end(ans));
  
  REP(n,ans.size()) {
    cout << ans[n];
    if(n < ans.size()-1) cout << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 2296
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
const int INF=1e9+5;
void max_self(ll &a,ll b)
{
    a=max(a,b);
    return;
}
int main()
{
    ll n,w;
    cin>>n>>w;
    vll dp(w+1);
    // dp[i] - max total value of items with weight i
    for(ll item=0;item<n;item++)
    {
        ll weight,value;
        cin>>weight>>value;
        for(ll weight_already=w-weight;weight_already>=0;weight_already--)
        {
            max_self(dp[weight_already+weight],dp[weight_already]+value);
        }
    }
    ll ans=0;
    for(ll i=0;i<=w;i++)
    {
        max_self(ans,dp[i]);
    }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 1024
from collections import deque

k = int(input().strip())

q=deque()
for i in range(1,10):
    q.append(i)
    if i==k:
        print(i)
        exit()
i=1
while True:
    old=q.popleft()
    if i==k:
        ans=old
        break
    last=old%10
    if last!=0:
        q.append(old*10+last-1)
    q.append(old*10+last)
    if last!=9:
        q.append(old*10+last+1)
    i+=1
print(ans)

Measured memory_bytes: 11956
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    ll x = 0;
    rep(i, n) x ^= a[i];
    cout << (x == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
// cout<<fixed<<setprecision(10);
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int t[1001];

void init() {
    t[1] = 1;
    for(int i=2; i<1000; i++){
        t[i] = t[i-1] + i;
    }
}
int main() {
    int a, b; cin >> a >> b;
    init();

    int diff = b-a;
    cout << t[diff] - b << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
	ll A, B;
    cin >> A >> B;
    ll ans = -1;
    rep(i,10001){
        if(100*i*0.08-100*A >= 0 && 100*i*0.08-100*A < 100){
            if(100*i*0.1-100*B >= 0 && 100*i*0.1-100*B < 100){
                ans = i;
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  int f = true;
  rep(i, 0, s.length()) {
    if(i == n) {
      if(s[i] != '-') f = false;
    }else {
      if(s[i] < '0' || s[i] > '9') f = false;
    }
  }
  cout << (f ? "Yes" : "No") << endl;
}


Measured memory_bytes: 384
from math import factorial

N, M = map(int, input().split())
if abs(N - M) > 1:
    print(0)
else:
    ans = factorial(N) * factorial(M)
    if N == M:
        ans = (2 * ans) % (10 ** 9 + 7)
    else:
        ans = ans % (10 ** 9 + 7)
    print(ans)


Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;
int a[100007];
int ans[100007];


int main(){
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++){
    cin>>a[i];
    ans[i]=INT_MAX;
}
ans[0]=0;
for(int i=0;i<n;i++){
    for(int j=1;j<=k;j++){
        if(j<n) ans[i+j]=min(ans[i+j],abs(a[i]-a[i+j])+ans[i]);
    }
}
cout<<ans[n-1];
}


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	ll n, k;
	cin >> n >> k;

	vector<ll> dp(k);
	for (ll i = 1; i <= n; i++) {
		dp[i % k]++;
	}

	ll res = 0;
	for (ll a = 0; a < k; a++) {
		ll b = (k - a) % k;
		ll c = (k - a) % k;

		if ((b + c) % k != 0) {
			continue;
		}

		res += dp[a] * dp[b] * dp[c];
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int t, x;
	double ans;
	cin >> t >> x;
	ans = double(t) * 1.0 / double(x);
	cout << ans << endl;
}

Measured memory_bytes: 3788
import sys
n, k = list(map(int, input().split()))

if (k == 1):
    print(0)
    sys.exit()

ans = 0
v_ans = 0
if (n > k):
    v_ans = n % k
else:
    v_ans = n

if (abs(v_ans - k) < v_ans):
    ans = abs(v_ans - k)
else:
    ans = v_ans

print(ans)


Measured memory_bytes: 9112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

const int mod=1e9+7;

template< int mod >
struct ModInt {
  int x;
 
  ModInt() : x(0) {}
 
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
 
  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }
 
  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
 
  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }
 
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
 
  ModInt operator-() const { return ModInt(-x); }
 
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
 
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
 
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
 
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
 
  bool operator==(const ModInt &p) const { return x == p.x; }
 
  bool operator!=(const ModInt &p) const { return x != p.x; }
 
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
 
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
 
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
 
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
 
  static int get_mod() { return mod; }
};
 
using modint = ModInt< mod >;
 

int main(){
  ll n,p;cin>>n>>p;
  vector<int> divs;
  for(ll i=1;i*i<=n;++i){
    divs.push_back(i);
    if(i!=n/i)divs.push_back(n/i);
  }
  sort(all(divs));
  int m=divs.size()+1;
  int nums[m];
  nums[1]=1;
  rep(i,divs.size()-1){
    nums[i+2]=divs[i+1]-divs[i];
  }
  modint dp[p+1][m];
  
  rep(i,1,divs.size()+1){
    dp[1][i]=dp[1][i-1]+nums[i];
    //cout<<dp[1][i]<<" "<<1<<","<<i<<endl;
  }
  rep(i,2,p+1){
    rep(j,1,m){
      dp[i][j]+=dp[i-1][m-j]*nums[j];
      //cout<<dp[i][j]<<" "<<i<<","<<j<<endl;
      dp[i][j]+=dp[i][j-1];
    }
  }
  modint ans=0;


  cout<<dp[p][m-1]<<endl;
}

Measured memory_bytes: 25852
#include <stdio.h>

int a(int n,int A[],int key)
{
  int i;
  
  i = 0;
  A[n] = key;
  while (A[i] != key){
    i++;
  }
  if (i == n){
    return 0;
  }
  return 1;
}


int main()
{
  int n, q, i, count;
  
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }

  count = 0;

  for(i=0;i<q;i++){
    if(a(n,S,T[i]) == 1){
      count++;
    }
  }

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

  return 0;
}




Measured memory_bytes: 2052
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define ll long long
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main(){
  int N;
  cin >> N;
  
  int out = 0;
  int count;
  
  for(int i=1; i<N+1; i+=2){
    count = 0;
    FOR(j, 1, i+1){
      if(i%j==0) count++;
    }
    if(count==8) out++;
  }
  
  cout << out << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N,M;
    unsigned long long int ans=1;
    cin>>N>>M;
    if(fabs(N-M)>1){
        cout<<0;
    }else{
        for(int i=1;i<=N;i++){
            ans*=(i%1000000007);
            ans%=1000000007;
        }
        for(int i=1;i<=M;i++){
            ans*=(i%1000000007);
            ans%=1000000007;
        }
        if(fabs(N-M)==0){
            ans*=2;
            ans%=1000000007;
        }
        cout<<ans;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
 
int main()
{
    
        int n;
        cin>>n;
        ll sum = 0;
       for(int i = 1; i <= n; i++)
       {
           if(i%3 == 0)
           continue;
           if(i%5 == 0)
           continue;
           sum += i;
       }
        cout<<sum<<endl; 
}

Measured memory_bytes: 3632
def code():
	l = []
	while True:
		m,f,r = map(int,input().split())
		if m == f == r == -1:
			break
		else:
			l.append([m,f,r])
	for i in l:
		s = ''
		x = i[0]+i[1]
		if i[0] == -1 or i[1] == -1:
			s = 'F'
		elif x >= 80:
			s = 'A'
		elif x >= 65:
			s = 'B'
		elif x >= 50:
			s = 'C'
		elif x >= 30:
			s = 'D'
			if i[2] >= 50:
				s = 'C'
		else:
			s = 'F'
		print(s)
code()

Measured memory_bytes: 7768
import sys

def main():
    N = int(input())
    K = int(input())
    l = input().split() #N個のstrのリスト

    result = 0

    for i in l:
        pos = int(i)
        if abs(pos-K)<pos:
            result += abs(pos-K)*2
        else :
            result += pos*2

    print(result)


if __name__=='__main__':
    main()

Measured memory_bytes: 3060
input_line1 = map(int,raw_input().split(" "))
#input_line2 = map(int,raw_input().split(" "))
#input_line = raw_input().split(" ")
a = input_line1[0]
b = input_line1[1]
c = input_line1[2]

if b - a == c - b:
	print "YES"
else:
	print "NO"

Measured memory_bytes: 2568
let a, b, c = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let m, p = if a > b then if a > c then a, b * c else c, a * b else if b > c then b, a * c else c, a * b
let _ = Printf.printf "%d\n" @@ if a mod 2 = 0 || b mod 2 = 0 || c mod 2 = 0 then 0 else (m - m / 2 * 2) * p

Measured memory_bytes: 384
X = int(input())

if X >= 400 and X <= 599:
  print(8)
elif X >= 600 and X <= 799:
  print(7)
elif X >= 800 and X <= 999:
  print(6)
elif X >= 1000 and X <= 1199:
  print(5)
elif X >= 1200 and X <= 1399:
  print(4)
elif X >= 1400 and X <= 1599:
  print(3)
elif X >= 1600 and X <= 1799:
  print(2)
elif X >= 1800 and X <= 1999:
  print(1)

Measured memory_bytes: 61708
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long int
    int main()
    {
    	ll i,j,k,m,n,t;
    	string s;
    	cin>>n;
    	ll ans=(n/500)*1000;
    	n%=500;
    	ans+=(n/5)*5;cout<<ans;
    }

Measured memory_bytes: 256
n=int(input())
xy=[list(map(int,input().split())) for i in range(n)]
sum = 0
for i in range(n):
    for j in range(n):
        sum += ((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**0.5
print(sum/n)


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

#define ll long long

int main(){
	ll t = 1;
	while (t--){
		string a, b; cin >> a >> b;
		if ( b.size() == a.size() + 1 && b.substr(0, a.size()) == a ) cout << "Yes\n";
		else cout << "No\n";
	}
}

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


int main() {

	int count = 0, count_max = 0;
	long int tmp;
	int i, j;

	int flag = 0;
	int a[3];

	for ( i = 0; i < 3; i++)
	{
		cin >>a[i];
	}
	
	sort(a, a+3);
	
	if ((a[2] - a[0]) % 2 == 0)
	{
		tmp = (a[2] - a[0]) /2;
		a[0] += tmp*2;
		count += tmp;
	}
	else
	{
		tmp = (a[2] - a[0]) /2;
		a[0] += tmp*2;
		count += tmp;
		flag += 1;
	}

	if ((a[2] - a[1]) % 2 == 0)
	{
		tmp = (a[2] - a[1]) /2;
		a[1] += tmp*2;
		count += tmp;
	}
	else
	{
		tmp = (a[2] - a[1]) /2;
		a[1] += tmp*2;
		count += tmp;
		flag += 1;
	}
	
	if (flag == 0)
	{
		cout << count << endl;
	}
	else if (flag%2 == 0 && flag != 0)
	{
		count++;
		cout << count << endl;
	}
	else if (flag%2 == 1 && flag != 0)
	{
		count+=2;
		cout << count << endl;
	}
	
	
	
	
}

Measured memory_bytes: 3632
/*
I believe on myself and I will achieve
this->author = Fuad Ashraful Mehmet, CSE-UAP
Todo:
https://www.codechef.com/COOK119?itm_campaign=contest_listing
*/
#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(int)n;++i)
#define all(o) (o).begin(),(o).end()
#define dbg(o)  cerr<<"at "<<__LINE__<<" response = "<<o<<endl;
#define pb push_back
using namespace std;

const int N=2e5+5;
typedef long long ll;
int n,m,d,k,cs=1;


bool isValid(int x,int y,int z)
{
      if(x==y or x==z or y==z)return false;

      if(x+y>z  and x+z>y  and y+z>x)return true;
      return false;
}
void HalfDead()
{
      
      int res=0;
      cin>>n;
      vector<int>a(n);
      for(int &x:a)cin>>x;

      for(int i=0;i<n;++i)
      {
            for(int j=i+1;j<n;++j)
            {
                  for(int k=j+1;k<n;++k)
                  {
                        res+=isValid(a[i],a[j],a[k]);
                  }
            }
      }

      cout<<res<<endl;
}
int main()
{
      ios_base::sync_with_stdio(0); cin.tie(nullptr);
      int tc=1;
     // cin>>tc;
      while(tc--)
      {
            HalfDead();
      }
      return 0;
}

Measured memory_bytes: 3656
n ,k = map(int ,input().split())
hai = list(map(lambda x:(int(x)+1)/2 ,input().split()))
hait= hai[:k]
ans = tmp = sum(hait)
for i in range(k,n):
  tmp = tmp - hai[i-k] + hai[i]
  if ans < tmp:
    ans = tmp
print(ans)

Measured memory_bytes: 23588
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;

signed main()
{
  int N;
  cin >> N;

  priority_queue<int, vector<int>, greater<int>> mae;
  int maesum = 0;
  vector<int> A(3*N);
  for( int i = 0; i < 3*N; i++ ){
    cin >> A.at(i);
    if( i < N ){
      mae.push(A.at(i));
      maesum += A.at(i);
    }
  }

  vector<int> maeK(N+1, 0);
  maeK.at(0) = maesum;

  int cnt = 1;
  for( int i = N; i < 2*N; i++ ){
    mae.push(A.at(i));
    maesum += (A.at(i) - mae.top());
    mae.pop();
    maeK.at(cnt) = maesum;
    cnt++;
  }
  
  priority_queue<int> ushiro;
  int usum = 0;
  for( int i = 3*N-1; i >= 2*N; i-- ){
    ushiro.push(A.at(i));
    usum += A.at(i);
  }
  
  vector<int> ushiroK(N+1, 0);
  ushiroK.at(N) = usum;
  cnt = N-1;
  for( int i = 2*N-1; i >= N; i-- ){
    ushiro.push(A.at(i));
    usum += (A.at(i) - ushiro.top());
    ushiro.pop();
    ushiroK.at(cnt) = usum;
    cnt--;
  }
  
  int ans = -1000000000000000;

  for( int i = 0; i <= N; i++ ){
    if( maeK.at(i) - ushiroK.at(i) > ans ) ans = maeK.at(i) - ushiroK.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 5876
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>

using namespace std;

int main(){
    int N;
    scanf("%d",&N);
    int h[N];
    for(int i=0;i<N;i++){
        scanf("%d",&h[i]);
    }
    bool flw[N][101];
    for(int i=0;i<N;i++){
        for(int j=0;j<101;j++){
            flw[i][j] = false;
        }
    }


    for(int i=0;i<N;i++){
        for(int j=0;j<=100;j++){
            if(h[i]>=j){
                flw[i][j] = true;
            }else{
                flw[i][j] = false;
            }
        }
    }
    int cnt=0;
    for(int j=1;j<=100;j++){
        for(int i=0;i<N-1;i++){
            if(flw[i][j]&&!flw[i+1][j]){
                cnt++;
            }
        }
        if(flw[N-1][j])cnt++;
    }
    cout<<cnt<<"\n";

}



Measured memory_bytes: 256
#include <iostream>                                 
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if(b<a) swap(a,b);
if(c<b) swap(b,c);
if(b<a) swap(a,b);

cout<<a<<" "<<b<<" "<<c<<endl;
}

 

Measured memory_bytes: 1168
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

struct node{
	LL pos,x;
}b[200005];
bool cmpnode(node x,node y){ return x.pos < y.pos; }

struct queryy{
	LL l,r,id;
}q[400005];

LL n,m,tot = 0;
LL lb[200005],a[200005];
LL fa[200005];

LL ec = 0,to[400005],nxt[400005],w[400005],hed[200005] = {0};
void add_edge(LL f,LL t,LL cst){
	++ ec; to[ec] = t; w[ec] = cst; nxt[ec] = hed[f]; hed[f] = ec;
}

LL getf(LL x){
	if(x == fa[x]) return x;
	return fa[x] = getf(fa[x]);
}

void mergee(LL x,LL y,LL z){
	if(getf(x) == getf(y)) return;
	add_edge(x,y,z); add_edge(y,x,z);
//	cout << x << ' ' << y << endl;
	fa[getf(x)] = getf(y);
}

LL val[200005],fal = 0,ans[200005],vis[200005] = {0};
void dfs(LL u,LL f,LL fe){
	val[u] = a[u]; vis[u] = 1;
	for(LL i = hed[u];i;i = nxt[i]){
		LL v = to[i];
		if(v == f) continue;
		dfs(v,u,w[i]);
		val[u] ^= val[v];
	}
	if(val[u]) ans[fe] = 1;
	if(ans[0]) fal = 1;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for(LL i = 1;i <= n;i ++) cin >> b[i].pos >> b[i].x; b[n + 1].x = 0;
	sort(b + 1,b + 1 + n,cmpnode);
	for(LL i = 1;i <= n;i ++) lb[i] = b[i].pos; lb[n + 1] = 0x3f3f3f3f3f3f3f3f;
	for(LL i = 1;i <= n + 1;i ++) a[i] = b[i].x ^ b[i - 1].x;
	for(LL i = 1;i <= n + 1;i ++) fa[i] = i;
	
	for(LL i = 1;i <= m;i ++){
		cin >> q[i].l >> q[i].r; q[i].id = i;
		q[i].l = lower_bound(lb + 1,lb + 2 + n,q[i].l) - lb;
		q[i].r = upper_bound(lb + 1,lb + 2 + n,q[i].r) - lb - 1;
	}
	
//	for(LL i = 1;i <= m;i ++) cout << q[i].l << ' ' << q[i].r << ' ' << q[i].id << endl;
	
//	for(LL i = 1;i <= n + 1;i ++) cout << a[i] << (i == (n + 1) ? '\n' : ' ');
	for(LL i = 1;i <= m;i ++) mergee(q[i].l,q[i].r + 1,q[i].id);
	for(LL i = 1;i <= n + 1;i ++) if(!vis[i]) dfs(i,0,0);
	if(fal){ cout << -1 << endl; return 0; }
	for(LL i = 1;i <= m;i ++) if(ans[i]) tot ++;
	cout << tot << endl;
	for(LL i = 1;i <= m;i ++) if(ans[i]) cout << i << ' '; cout << endl;
	return 0;
}

Measured memory_bytes: 30464
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int n;
    scanf("%d",&n);
    int a[1000] = {};


    ll ans = 1;

    rep(i,n+1){
        int ii = i;
        int j = 2;
        while(ii>1){
            if(ii%j==0){
                a[j]++;
                ii /= j;
                continue;
            }
            j++;
        }
    }
    rep(i,1000){
        ans *= (a[i]+1);
        ans %= 1000000007;
    }
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int find_p(int x) {
	int tmp=x;
	while(tmp>=10) tmp/=10;
	return tmp;
}
int ans=0,c[20][20];
int main()
{
	memset(c,0,sizeof(c));
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		int j=find_p(i),k=i%10;
		c[j][k]++;
	}
	for(int i=0;i<=9;++i)
		for(int j=0;j<=9;++j)
			ans+=c[i][j]*c[j][i];
	printf("%d",ans);
	return 0;
}

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

int c[1000][1000];

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> hs, rs;
        int h_max = 0, r_max = 0;
        for (int i = 0; i < n; i++) {
            int h, r;
            cin >> h >> r;
            hs.push_back(h);
            rs.push_back(r);
            h_max = max(h_max, h);
            r_max = max(r_max, r);
        }
        int m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            int h, r;
            cin >> h >> r;
            hs.push_back(h);
            rs.push_back(r);
            h_max = max(h_max, h);
            r_max = max(r_max, r);
        }
        for (int y = 0; y <= h_max; y++) {
            for (int x = 0; x <= r_max; x++) {
                c[y][x] = 0;
            }
        }
        for (int i = 0; i < m+n; i++) {
            c[hs[i]][rs[i]] = 1;
        }
        for (int y = 1; y <= h_max; y++) {
            for (int x = 1; x <= r_max; x++) {
                c[y][x] = max(c[y][x] + c[y-1][x-1], max(c[y-1][x], c[y][x-1]));
            }
        }
        cout << c[h_max][r_max] << endl;
    }
}

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

int V[101][10001];
int v[101];
int w[101];

int main(){
  int N,W;
  cin >> N >> W;
  v[0]=0;
  w[0]=0;
  for(int i=0;i<=N;++i){
    for(int j=0;j<=W;++j){
      V[i][j]=0;
    }
  }
  
  for(int i=1;i<=N;++i){
    cin >> v[i] >> w[i] ;
  }
  
  for(int i=1;i<=N;++i){
    for(int c=1;c<=W;++c){
      
      V[i][c]=V[i-1][c];
      if(c>=w[i]) V[i][c]=max(V[i][c],v[i]+V[i][c-w[i]]);
      for(int k=1;k<i;++k){
  	if(c>=w[i-k]) V[i][c]=max(V[i][c],v[i-k]+V[i-1][c-w[i-k]]);
      }
    }
    
  }
  
  cout << V[N][W] << endl;				  
}

Measured memory_bytes: 5104
import java.util.Scanner;

public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//A
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(b < a)
			System.out.println(a-1);
		else
			System.out.println(a);
	}
}


Measured memory_bytes: 20688
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int N;

  cin >> N;

  vector<int64_t> s(N+1);

  s.at(0)=2; s.at(1)=1;

  if(N>=2){
    for(int i=2;i<N+1;i++){
    s.at(i)=s.at(i-1) + s.at(i-2);
    }
  }
  

  cout << s.at(N) <<endl;
 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int m, d, z = 0;
    cin >> m >> d;
    for (int i = 1; i <= m; i++) for (int j = 1; j <= d; j++) if (j / 10 >= 2 && j % 10 >= 2 && (j / 10) * (j % 10) == i) z++;
    cout << z;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
string sa;
ll d,dp[10010][110];
ll dfs_dp(int pos,ll sta,bool lim)
{
	if(pos==sa.size())
		return sta%d==0;
	if(!lim && dp[pos][sta]!=-1)
		return dp[pos][sta];
	ll up=lim?(sa[pos]-'0'):9,res=0;
	for(int i=0;i<=up;i++)
		res=(res+dfs_dp(pos+1,(sta+i)%d,lim&(i==up)))%mod;
	if(!lim)
		dp[pos][sta]=res;
	return res;
}
ll work()
{
	return dfs_dp(0,0,1);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	cin>>sa>>d;
	cout<<(work()+mod-1)%mod<<endl;
	return 0;
}

Measured memory_bytes: 13032
#include <stdio.h>

int main(void){
    int a, b;
    int s, l;
    
    scanf("%d %d",&a,&b);
    
    l = 2 * a + 2 * b;
    s = a * b;
    
    printf("%d %d\n",s,l);
    
    return 0;
}

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

using ll =  long long;
using pint =  pair<int,int>;

#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(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#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式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n,k;cin >> n >> k;
  int ans=0;
  rep(i,n){
    int h;cin >> h;
    if(h>=k)ans++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

//const long long MOD = 1000000007;
const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE d(n); rep(i, n)cin >> d[i];
	VE tmp(n);
	int MAX = 0;
	rep(i, n) {
		if (i == 0) {
			if (d[i] != 0) {
				cout << 0 << endl; return 0;
			}
		}
		tmp[d[i]]++; chmax(MAX, d[i]);
	}
	if (tmp[0] != 1) {
		cout << 0 << endl; return 0;
	}
	int ans = 1;
	rep(i, MAX) {
		rep(j, tmp[i + 1]) {
			ans *= tmp[i]; ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792