akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 998244353

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 200009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
ll fact[N];
void precompute()
{
	fact[0]=1;
	rep(i,1,N)
	fact[i]=(i*fact[i-1])%hell;
}
ll ncr(ll n,ll r)
{
	ll lol=fact[n];
	ll lol2=(fact[r]*fact[n-r])%hell;
	lol2=power(lol2,hell-2,hell);
	lol*=lol2;
	lol%=hell;
	return lol;
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
        
	ll n,k,m;cin>>n>>m>>k;
	precompute();

	ll ans=0;
/*	test1(ncr(5,2));
	test1(ncr(7,3));*/
	rep(i,0,k+1)
	{
		ll p=n-i;
		ll lol=ncr(n-1,p-1);
		ll lol2=m*(power(m-1,p-1,hell));
		lol2%=hell;
		lol*=lol2;
		lol%=hell;
		ans+=lol;
		ans%=hell;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5220
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int main()
{
	int sum=0;
	scanf("%s",s);
	for(int i=0 ; i<strlen(s)-1; i++)
	{
		if(s[i]!=s[i+1])
		sum+=1;
	}
	printf("%d\n",sum);
	return 0;
}

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

#l = list(map(int, input().split()))
#import numpy as np
#arr = np.array([int(i) for i in input().split()])
'''
a,b=[],[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

n=int(input())
a=list(map(int,input().split()))
x=0
for item in a:
    x^=item
ans=[]
for item in a:
    ans.append(x^item)
ans=map(str,ans)
print(" ".join(ans))

Measured memory_bytes: 39020
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	aSlice := make([]int, n)
	for i := range aSlice {
		fmt.Scan(&aSlice[i])
	}

	sort.Ints(aSlice)

	a := aSlice[0]
	for i := 1; i < n; i++ {
		b := aSlice[i]
		r := b % a
		for r != 0 {
			b = a
			a = r
			r = b % a
		}
	}
	fmt.Println(a)
}

Measured memory_bytes: 5504
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut it = s.split_whitespace();
	let n: usize = it.next().unwrap().parse().unwrap();
	let c: usize = it.next().unwrap().parse().unwrap();
	let mut prg = vec![vec![]; c];
	for _ in 0..n {
		let s: i32 = it.next().unwrap().parse().unwrap();
		let t: i32 = it.next().unwrap().parse().unwrap();
		let c: usize = it.next().unwrap().parse().unwrap();
		prg[c - 1].push((s, t));
	}
	let prg = {
		let mut res = vec![vec![]; c];
		for c in 0..c {
			prg[c].sort();
			let prg = &prg[c];
			let mut l = 0;
			while l < prg.len() {
				let mut cur = prg[l];
				let mut r = l + 1;
				while r < prg.len() && cur.1 == prg[r].0 {
					cur.1 = prg[r].1;
					r += 1;
				}
				res[c].push(cur);
				l = r;
			}
		}
		res
	};
	let mut all = vec![0; 200005];
	for prg in prg.iter() {
		for &(l, r) in prg {
			all[2 * l as usize - 1] += 1;
			all[2 * r as usize + 1] -= 1;
		}
	}
	let mut ans = 0;
	for i in 1..all.len() {
		all[i] += all[i - 1];
		if ans < all[i] {
			ans = all[i];
		}
	}
	println!("{}", ans);
}


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

int main(){
  int n;
  cin >> n;
  int vec[n];
  for(int i = 0; i < n; i++){
    cin >> vec[i];
  }
  for(int i = n - 1; i >= 1; i--){
    cout << vec[i] << " ";
  }
  cout << vec[0] << endl;
}


Measured memory_bytes: 3092
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll A,B,C,D;
    ll ans=0;
    ll X[4];
    string S,T;
int main(){
    REP(i,4)cin>>X[i];
    sort(X,X+4);
    cout<<((X[0]+X[1]*10+X[2]*100+X[3]*1000==9741)?"YES":"NO")<<endl;
    return 0;
}


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

using namespace std;

class UnionFind {
public:
    vector<int> Parent;

    UnionFind(int N){
        Parent = vector<int>(N, -1);
    }

    int root(int A){
        if(Parent[A]<0) return A;
        return Parent[A] = root(Parent[A]);
    }

    int size(int A){
        return -Parent[root(A)];
    }

    bool connect(int A, int B){
        A = root(A);
        B = root(B);

        if( A == B ) return false;

        if( size(A) < size(B) ) swap(A,B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

int main() {
    int N, M;
    cin >> N >> M;

    vector<int> A(M), B(M);
    for(int i=0;i<M;i++) {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }

    vector<int64_t> ans(M);
    ans[M-1] = (int64_t)N * (N-1) / 2;

    UnionFind uf(N);

    for(int i=M-1;i>=1;i--){

        ans[i-1] = ans[i];

        if( uf.root(A[i]) != uf.root(B[i]) ){
            ans[i-1] -= (int64_t)uf.size(A[i]) * uf.size(B[i]);
            uf.connect(A[i], B[i]);
        }
    }

    for(int i=0;i<M;i++){
        cout << ans[i] << endl;
    }

}

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

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

int gcd(int a, int b) {
	while (b > 0) {
		a %= b;
		swap(a, b);
	}

	return a;
}

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

	int k;
	cin >> k;

	ll sum = 0;

	for (int a = 1; a <= k; a++) {
		for (int b = 1; b <= k; b++) {
			int t = gcd(a, b);
			for (int c = 1; c <= k; c++) {
				sum += gcd(t, c);
			}
		}
	}

	cout << sum;

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
 
const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
 
const int MAX = 1000000;
const int MOD = 1000000007;
 
int main(){
  ll n;
  cin >> n;
  int ans = 0;
  for(ll i=1; i*i<=n; i++){
    lrep(j, i, n){
      if(i*j>=n){
        break;
      }else{
        if(i==j)ans += 1;
        else ans += 2;
      }
    }
  }
  cout << ans << endl;
}

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

void solve(long long N) {
    map<ll, ll> map;
    for (ll x = 1; x <= 100; x++) {
        for (ll y = 1; y <= 100; y++) {
            for (ll z = 1; z <= 100; z++) {
                {
                    map[x * x + y * y + z * z + x * y + y * z + z * x]++;
                }
            }
        }
    }
    for (ll i = 1; i <= N; i++) {
        cout << map[i] << endl;
    }
}

int main() {
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 6120
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int n,m,c,total=0,d=0;
    cin>>n>>m>>c;
    vector<int> b(m);
    rep(j,m) cin>>b[j];
    rep(i,n){
        rep(j,m){
            int a;
            cin>>a;
            total += a*b[j];
        }
        total += c;
        if(total>0) d++;
        total=0;
    }
    cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 384
x, n = gets.split(' ').map(&:to_i)
ps = n == 0 ? [] : gets.split(' ').map(&:to_i)

result = 100
min_abs = 100

target_arr = (0..101).to_a.select { |i| !ps.include?(i) }

target_arr.each do |i|
  abs = (x - i).abs
  if abs < min_abs
    result = i
    min_abs = abs
  elsif abs == min_abs && i < result
    result = i
  end
end

puts result


Measured memory_bytes: 14444
#include<stdio.h>
int main()
{
    int a,b[100000],d,c,i;
    scanf("%d %d",&a,&c);
    d=a;
    for(i=0;i<c;i++)
    {
        scanf("%d",&b[i]);
    d=d-b[i];
    }
    if(d<=0)
    {
        printf("Yes");
    }
    else
        printf("No");
}

Measured memory_bytes: 512
#include <cstdio>

int main()
{
    int r, c;
    int n[101][101] = {};
    int i, j;
    int sum;
    scanf("%d %d", &r, &c);
    for (i = 0; i < r; i++)
    {
        for (j = 0; j < c; j++)
        {
            scanf("%d", &n[i][j]);
            n[r][c] += n[i][j];
        }
    }
    for (i = 0; i < r; i++)
    {

        for (j = 0; j < c; j++)
        {
            n[i][c] += n[i][j];
        }
    }
    for (j = 0; j < c; j++)
    {
        for (i = 0; i < r; i++)
        {
            n[r][j] += n[i][j];
        }
    }
    for (i = 0; i <= r; i++)
    {
        for (j = 0; j <= c; j++)
        {
            if (j == c)
            {
                printf("%d", n[i][j]);
            }
            else
            {
                printf("%d ", n[i][j]);
            }
        }
        printf("\n");
    }
    return 0;
}


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

int main(void) {
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  int answer = 0;
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    answer += min(2 * x, 2 * (K - x));
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <regex>

using namespace std;

int main() {
    int a, b;
    string s;
    cin >> a >> b;
    cin >> s;
    for (int i = 0; i < a; i++) {
        if (s[i] > '9' || s[i] < '0') {
            cout << "No" << endl;
            return 0;
        }
    }
    if (s[a] != '-') {
        cout << "No" << endl;
        return 0;
    }
    for (int i = a + 1; i < a + b + 1; i++) {
        if (s[i] > '9' || s[i] < '0') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
vec = []

line = []
for i in range(h):
    vec.append(input())
    if '#' in vec[i]:
        line.append(i)

row = []
for i in range(w):
    for j in range(h):
        if vec[j][i] == '#':
            row.append(i)
            break

for i in line:
    for j in row:
        print(vec[i][j], end='')
    
    print()

Measured memory_bytes: 4468
line=str(input())
line=list(line)
line=list(map(int,line))
a=line[0]
b=line[1]
c=line[2]
d=line[3]
o1='+'
o2='+'
o3='+'
count=0
for x in (a+b,a-b):
  for y in (c,-c):
    for z in (d,-d):
      if x+y+z==7 and count==0:
        if x==a-b:
          o1='-'
        if y==-c:
          o2='-'
        if z==-d:
          o3='-'
        count+=1
print("{}{}{}{}{}{}{}=7".format(a,o1,b,o2,c,o3,d))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

ll n, m;
vector<vector<ll>> g, dp;

void dfs(ll v, ll p = -1, ll bit = 0) {
    if (bit & (1 << v)) return;
    bit |= 1 << v;
    dp[v][bit]++;
    for(auto &x : g[v]) {
        if (x == p) continue;
        dfs(x, v, bit);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    cin >> n >> m;
    g.resize(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dp.resize(n, vector<ll>(1 << n, 0));
    dfs(0);
    ll ans = 0;
    rep(i, n) ans += dp[i][(1 << n) - 1];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3676
//8 Queens Problem
//2019-01-30
//Ebitani Akira

#include <stdio.h>

#define N 8
#define FREE -1
#define BURIED 1

void Process(int);
void Print();

int row[N], cul[N], dl[2*N-1], dr[2*N-1];
int A[N][N];

int main (){
  int i, j;
  int k, r, c;

  for(i = 0 ; i < N ; i++){
    row[i] = -1;
    cul[i] = -1;
  }
  for(i = 0 ; i < N*2-1 ; i++){
    dl[i] = -1;
    dr[i] = -1;
    //printf("%d", dl[i]);
  }

  for(i = 0 ; i < N ; i++){
    for(j = 0 ; j < N ; j++){
      A[i][j] = 0;
      //printf("%d", A[i][j]);
    }
  }

  scanf("%d", &k);
  for(i = 0 ; i < k ; i++){
    scanf("%d%d", &r, &c);
    A[r][c] = 1;
    //printf("%d", A[i][j]);
  }
  Process(0);

  return 0;
}

void Process(int a){
  int j;

  if(a == N){
    //printf("test\n");
    Print();
    return;
  }

  for(j = 0 ; j < N ; j++){
    if(cul[j] == 1||
	     dl[a+j] == 1||
	     dr[a-j+N-1] == 1)continue;
    row[a] = j;
    cul[j] = dl[a+j] = dr[a-j+N-1] = 1;

    Process(a+1);

    row[a] = cul[j] = dl[a+j] = dr[a-j+N-1] = -1;

  }
}

void Print(){
  int i, j;

  for(i = 0 ; i < N ; i++){

    //printf("test\n");
    for(j = 0 ; j < N ; j ++){
      if(A[i][j]){
        //printf("test\n");
	      if(row[i] != j)return;

      }
    }
  }
  //printf("test\n");
  for(i = 0 ; i < N ; i++){
    for(j = 0 ; j < N ; j ++){
      //printf("test\n");
      if(row[i] == j){
        printf("Q");
      }
      else{
	      printf(".");
      }
    }
    printf("\n");
  }
}



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

#define inf 0x3f3f3f3f

using namespace std;

typedef long long ll;

int i, j;
string s;
int n;
ll dp[100001][13] = {0};
const ll mod = 1e9 + 7;

void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(c - a + b, 0) << endl;
  return;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
#define MPlus(x,y) {x=(x+y)%M;}
#define MSub(x,y) {x=(x-y+M)%M;}
#define MMul(x,y) {x=(x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n,k;
  cin>>n>>k;
  vi a(n);
  rep(i,n){
    cin>>a[i];
  }

  vi b(n+1,0);
  rep(i,n){
    b[i+1]=b[i]+a[i]-1;
    b[i+1]%=k;
  }

  map<int,int> mp;
  int ans=0;
  rep(i,n+1){
    ans+=mp[b[i]];
    mp[b[i]]++;
    if(i-k+1>=0)
      mp[b[i-k+1]]--;
  }

  cout<<ans<<endl;

  /*
  rep(i,n+1){
    cout<<b[i]<<endl;
  }
  */

}

Measured memory_bytes: 15872
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,c;
    cin>>n>>c;
    vec x(n+2),y(n+2);
    rep(i,n){
        cin>>x[i+1]>>y[i+1];
    }
    x[n+1]=c;

    vec memoa(n+2);
    vec memob(n+2);

    for(int i=1;i<=n;i++){
        memoa[i]=memoa[i-1]+y[i]-(x[i]-x[i-1]);
        memob[i]=memoa[i]-x[i]; // そこから引き返した時
    }

    for(int i=1;i<=n;i++){
        chmax(memoa[i],memoa[i-1]);
        chmax(memob[i],memob[i-1]);
    }

    vec memoc(n+2);
    vec memod(n+2);

    for(int i=n;i>=1;i--){
        memoc[i]=memoc[i+1]+y[i]-(x[i+1]-x[i]);
        memod[i]=memoc[i]-(c-x[i]); // そこから引き返した時
    }

    for(int i=n;i>=1;i--){
        chmax(memoc[i],memoc[i+1]);
        chmax(memod[i],memod[i+1]);
    }

    /*
    rep(i,n+2) cout<<memoa[i]<<" ";
    cout<<endl;
    rep(i,n+2) cout<<memob[i]<<" ";
    cout<<endl;
    rep(i,n+2) cout<<memoc[i]<<" ";
    cout<<endl;
    rep(i,n+2) cout<<memod[i]<<" ";
    cout<<endl;
    */

    ll ans=0;
    for(int i=0;i<n+1;i++){
        chmax(ans,memoa[i]+memod[i+1]);
        chmax(ans,memob[i]+memoc[i+1]);
    }
    cout<<ans<<endl;


    
}

Measured memory_bytes: 4992
import sys

k = int(input())
q = []

for i in range(1, 10):
  q.append(i)

for i in range(k):
  
  n = q[i]
  
  if i == k - 1:
    print(n)
    sys.exit()
    
  if n % 10 != 0:
    q.append(10*n + (n % 10) - 1)
    
  q.append(10*n + (n % 10))
  
  if n % 10 != 9:
    q.append(10*n + (n % 10) + 1)

Measured memory_bytes: 15784
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define ll long long
int main()
{
    ll t,n,i,j,k,l,m,f,a,b,c,d,s;
    string s1,s2,s3;
    double x,y;
    cin>>n;
    if(n%2==0)
    {
        k=n/2;
    }
    else
    {
        k=n/2;
        k++;
    }
    x=(k*1.00/n);
    cout<<fixed<<setprecision(10)<<x<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int N, L;
	cin >> N >> L;

	auto sum = 0;
	for (auto i = 1; i <= N; ++i)
	{
		sum += L + i - 1;
	}

	auto minDiff = INT_MAX;
	auto result = 0;
	for (auto i = 1; i <= N; ++i)
	{
		auto diff = L + i - 1;
		if (abs(diff) < minDiff)
		{
			result = sum - diff;
			minDiff = abs(diff);
		}
	}

	cout << result << endl;

	return 0;
}

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

#define INC(i, a, b) for(int i = a; i < b; ++i)
#define DEC(i, a, b) for(int i = a; i > b; --i)
#define REP(i, n)    for(uint i = 0; i < n; ++i)

typedef unsigned int uint;
typedef unsigned long ul;
typedef long long  ll;
typedef unsigned long long ull;

using namespace std;

void TFprint(bool b, std::string T, std::string F){
    if(b){
        cout << T << endl;
    }else{
        cout << F << endl;
    }
}

int main(){
    int H, W; cin >> H >> W;
    int N; cin >> N;
    int a[N];
    REP(i, N){
        cin >> a[i];
    }
    int c[W][H];
    int index = 0;
    REP(y, H){
        REP(x, W){
            c[x][y] = index + 1;
            a[index]--;
            if(a[index] == 0) index++;
        }
    }

    REP(y, H){
        REP(x, W - 1){
            if(y % 2 == 0){
                cout << c[x][y] << ' ';
            }else{
                cout << c[W - 1 - x][y] << ' ';
            }
        }
        if(y % 2 == 0){
                cout << c[W - 1][y] << endl;
            }else{
                cout << c[0][y] << endl;
            }
    }
    return 0;
}

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

const int N = 21, P = 1 << N, MOD = 1e9 + 7;

bool b[P];
vector<int> cas[N];
int n, a[N][N], card[P], pos[P], p[N];

int DFS(int i) {
  if(b[i])
    return pos[i];
  b[i] = true;
  int c = i;
  for(int j = 0; j < n && c > 0; j++) {
    if(c % 2 == 1)
      if(a[card[i]][j] == 1)
      	pos[i] = (pos[i] + DFS(i - p[j])) % MOD;
    c /= 2;
  }
  return pos[i];
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
  b[0] = true;
  pos[0] = 1;
  
  cin >> n;
  for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++)
       cin >> a[i][j];
  
  for(int i = 0; i < n; i++)
    p[i] = 1 << i;
  
  for(int i = (1 << n)-1; i > -1; i--) {
    int j = i;
    while(j != 0) {
      card[i] += j % 2;
      j /= 2;
    }
    card[i]--;
  }
  
  cout << DFS((1 << n) - 1);
}

Measured memory_bytes: 18688
p, g = 998244353, 3
invg = pow(g, p-2, p)
W = [pow(g, (p - 1) >> i, p) for i in range(24)]
iW = [pow(invg, (p - 1) >> i, p) for i in range(24)]

def fft(k, f):
    for l in range(k)[::-1]:
        d = 1 << l
        u = 1
        for i in range(d):
            for j in range(i, 1 << k, 2*d):
                f[j], f[j+d] = (f[j] + f[j+d]) % p, u * (f[j] - f[j+d]) % p
            u = u * W[l+1] % p

def ifft(k, f):
    for l in range(k):
        d = 1 << l
        u = 1
        for i in range(d):
            for j in range(i, 1 << k, 2*d):
                f[j+d] *= u
                f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p
            u = u * iW[l+1] % p

def convolve(a, b):
    n0 = len(a) + len(b) - 1
    k = (n0).bit_length() + 1
    n = 1 << k
    a = a + [0] * (n - len(a))
    b = b + [0] * (n - len(b))
    fft(k, a), fft(k, b)
    for i in range(n):
        a[i] = a[i] * b[i] % p
    ifft(k, a)
    invn = pow(n, p - 2, p)
    for i in range(n0):
        a[i] = a[i] * invn % p
    return a[:n0]

N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
print(*convolve(A, B))


Measured memory_bytes: 220620
d = 1000000007
N, M = list(map(int, input().split()))
a = [int(input()) for i in range(M)]
safe = [True for i in range(N+1)]
for ai in a:
  safe[ai] = False
dp = [0 for i in range(N+1)]
dp[0] = 1
dp[1] = 1 if safe[1] else 0
for i in range(2, N+1):
  dp[i] = (dp[i-2]+dp[i-1]) % d if safe[i] else 0
print(dp[N])

Measured memory_bytes: 8624
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int H, W; cin >> H >> W;
	REP(i, H) {
		REP(j, W) {
			string s; cin >> s;
			if (s == "snuke") {
				char c = 'A' + j;
				cout << c << i + 1 << endl;
			}
		}
	}

	return 0;
}



Measured memory_bytes: 3608
import java.util.*;
import java.io.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		
		int n= sc.nextInt();
		int arr[] = new int[n+1];
		for(int i=1;i<=n;i++)
			arr[i] = sc.nextInt();
		long occ[] = new long[(int)2e5+1];
		HashMap<Integer,Long> hm = new HashMap<>();
		for(int i=1;i<=n;i++){
			occ[arr[i]]+=1;
			hm.put(arr[i],0l);
		}
		
		ArrayList<Integer> al = new ArrayList<>(hm.keySet());
		long total =0;
		int len = al.size();
		for(int i=0;i<len;i++){
			int val = al.get(i);
			long oc = occ[val];
			long temp = ((oc)*(oc-1))/2;
			hm.put(val,temp);
			total+=temp;
		}
		StringBuilder sb = new StringBuilder();
		for(int i=1;i<=n;i++){
			int val = arr[i];
			long gh =total-(occ[val]-1);
			sb.append(gh+"\n");
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 99124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int dp[55555];

int main() {
    for (int i = 0; i < 55555; i++) dp[i] = INF;
    int n, m;
    cin >> n >> m;
    dp[0] = 0;
    for (int i = 0, c; i < m; i++) {
        cin >> c;
        for (int j = c; j <= n; j++) {
            dp[j] = min(dp[j], dp[j - c] + 1);
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3332
def main():
    N=int(input())
    b=list(map(int,input().split()))
    result_inv=[]
    result_flag=True
    for _ in range(N):
        flag=False
        for i in range(len(b)):
            if i+1==b[i]:
                j=i
                flag=True
        if flag:
            a=b.pop(j)
            result_inv.append(a)
            flag=False
        else:
            result_flag=False
            break

    if result_flag:
        result=result_inv[::-1]
        for i in range(N):
            print(result[i])
    else:
        print(-1)

if __name__=="__main__":
    main()

Measured memory_bytes: 3064
/* #                          */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <deque>
#include <map>
//#pragma warning(disable:4996)
using namespace std;


/** Type Define **/

typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;

#define all(x)  x.begin(), x.end()
constexpr int               inf = 0x3f3f3f3f;
constexpr long long 		INF = 9123456789123456789;
constexpr long long         MOD = 1000000007LL;
/*************************************************/
int n, d, a;
ll ans(0);
vector<pll> M;
vl D;


int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cin.tie(nullptr);
    cin >> n >> d >> a;
    D.assign(n + 1, 0);
    for (int i = 0; i < n; i++) {
        int x, h;
        cin >> x >> h;
        int bomb = h / a + (h % a != 0 ? 1 : 0);
        M.push_back({ x, bomb });
    }
    sort(all(M));

    for (int i = 0; i < n; i++) {
        if (D[i] < M[i].second) {
            ll rest = M[i].second - D[i];
            ans += rest;
            D[i] += rest;
            ll bound = M[i].first + 2 * d;
            int p = upper_bound(all(M), pll{ bound, INF }) - M.begin();
            D[p] -= rest;
        }
        D[i + 1] += D[i];
    }

    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 7792
#include <bits/stdc++.h>
#define mkp make_pair
typedef long long ll;
using namespace std;
const char sp = ' ';
int N, M, res, A[300][300], c[300];
bool b[300];


int main() {
	cin >> N >> M;
	res = 0xE869120;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			cin >> A[i][j];
			--A[i][j];
		}
	}
	for (int i = 0; i < M; ++i) {
		b[i] = true;
	}
	for (int i = 0; i < M; ++i) {
		for (int j = 0; j < M; ++j) {
			c[j] = 0;
		}
		for (int j = 0; j < N; ++j) {
			for (int k = 0;; ++k) {
				if (b[A[j][k]]) {
					++c[A[j][k]];
					break;
				}
			}
		}
		pair<int, int> MAX = mkp(-1, -1);
		for (int j = 0; j < M; ++j) {
			MAX = max(MAX, mkp(c[j], j));
		}
		res = min(res, MAX.first);
		b[MAX.second] = false;
	}
	cout << res << endl;
}

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

ll gcd(ll a, ll b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return (a / g) * b;
}

int main() {
  int n, i;
  ll t, ans = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> t;
    ans = lcm(ans, t);
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix

N = int(input())
iXY = [[i] + list(map(int, input().split())) for i in range(N)]

P = set()
for j in [1, 2]:
  iXY.sort(key=lambda a: a[j])
  for i in range(1, N):
    i0, x0, y0 =  iXY[i - 1]
    i1, x1, y1 =  iXY[i]
    P.add((min(abs(x1 - x0), abs(y1 - y0)), i0, i1))

d, i, j = zip(*P)
G = csr_matrix((d, (i, j)), shape=(N, N))
mst = minimum_spanning_tree(G)
print(int(mst.sum()))

Measured memory_bytes: 81620
n,m=map(int,input().split())
ac=[0]*n
wa=[0]*n
acc,wac=0,0

for i in range(m):
  p,s=input().split()
  p=int(p)
  
  if ac[p-1]==1:
    continue
    
  else:
    if s=="AC":
      ac[p-1]=1
      
    else:
      wa[p-1]+=1
      
for i in range(n):
  if ac[i]==1:
    acc+=1
    wac+=wa[i]
    
print(acc,wac)

Measured memory_bytes: 10432
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> s(n);
  REP(i, 0, n) cin >> s[i];
  int tot = 0;
  REP(diff, 0, n) {
    bool ok = true;
    REP(i, 0, n) {
      REP(j, 0, n) {
	int ni = (diff + i) % n;
	int nj = (j - diff + n) % n;
	if (s[i][j] != s[nj][ni]) ok = false;
      }
    }
    tot += ok ? 1 : 0;
  }
  cout << tot * n << endl;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void){

    int N = 0;

    scanf("%d", &N);

    int count = N;
    int min = 9999999;

    int P[N];
    int check[N];

    for (int i = 0; i < N; i++){

        int flag = 0;
        check[i] = 0;

        scanf("%d", &P[i]);

        for (int j = i; j >= 0; j--){

            if(min > P[i]){

                min = P[i];
                break;
            }

            if(min < P[i]){
                
                count--;
                break;
            }

            if (P[i] > P[j]){

                count--;
                break;
            }
        } 
    }

    printf("%d", count);

    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main() {
  int k;
  cin >> k;
  k = k%32 -1;
  if(k==-1){k=31;}
  
  vector<int> a={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};
  cout << a[k] << endl;
  return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
line_a = gets.chomp.split(' ')
line_b = gets.chomp.split(' ')

taoseru = 0
line_b.map do |val|
  taoseru += val.to_i
end

while n >= 0
  tmp = line_b[n].to_i

  amari = line_b[n].to_i - line_a[n + 1].to_i
  amari = 0 if amari.negative?
  line_b[n] = amari

  amari = line_a[n + 1].to_i - (tmp - line_b[n])
  line_a[n + 1] = amari

  tmp = line_b[n].to_i

  amari = line_b[n] - line_a[n].to_i
  amari = 0 if amari.negative?
  line_b[n] = amari

  amari = line_a[n].to_i - (tmp - line_b[n])
  line_a[n] = amari

  n -= 1
end

nokori = 0
line_b.map do |val|
  nokori += val.to_i
end

puts taoseru - nokori


Measured memory_bytes: 17572
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	string s;
	cin >> s;
	cout << (((s[0]+s[1]+s[2]==(int)'A'*3)||(s[0]+s[1]+s[2]==(int)'B'*3))?"No":"Yes") << endl;
	return 0;
}


Measured memory_bytes: 256
"use strict"

function main(input) {


    input = input.split('\n')
    input = input[1].split(' ').map(Number)
    input.sort((x, y) => x - y)
    console.log(Math.abs(input[0] - input[input.length - 1]))

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

int main()

{

    int n, i, j, k;

    float a, b, w;

    float pi = acos(-1);

    scanf("%f %f %f", &a, &b, &w);

    float d = (a*a*b)/2;

    if (d > w) {

        float t = (a*b*b)/ (2*w);

        printf("%f", 180*atan(t)/ pi);

    }

    else if (d == w) {

        printf("%f", 180*atan(b/a)/ pi);

    }

    else {

        float t = (2*((a*a*b)-w))/ (a*a*a);

        printf("%f", 180*atan(t)/pi);

    }

    return 0;

}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	long long n;
	cin >> n;

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

	int cnt = 1;
	int ans = 0;
	int flag = 0;
	for (int i = 0;i < n;i++) {
		if (a[i] == cnt) {
			cnt++;
		}
		else {
			ans++;
		}
	}

	if (cnt == 1) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 4000
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

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

    vector<int> ans; ll cur = 0, p = 1;
    REP(i, 0, 64) {
        if ((N - cur) % abs(p * 2) != 0) {
            cur += p;
            ans.push_back(1);
        } else {
            ans.push_back(0);
        }
        p *= (-2);
        if (cur == N) break;
    }

    for (auto itr = ans.rbegin(); itr != ans.rend(); itr++) cout << *itr;
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[500005]={0};
	long n;
	for(cin>>s;s[n];n++);n++;
	vector<long>a;
	long buf=s[0]=='<'?1:-1;
	for(long i=1;i<n-1;i++)
	{
		if(buf>0&&s[i]=='<')buf++;
		else if(buf<0&&s[i]=='>')buf--;
		else if(buf>0&&s[i]=='>')a.emplace_back(buf),buf=-1;
		else if(buf<0&&s[i]=='<')a.emplace_back(buf),buf=1;
	}
	a.emplace_back(buf);
	n=a.size();
	if(n==1){cout<<abs(a[0])*(abs(a[0])+1)/2<<endl;return 0;}
	long ans=0;
	if(a[0]>0)
	{
		if(abs(a[0])>abs(a[1]))ans+=a[0]*(a[0]+1)/2;
		else ans+=a[0]*(a[0]-1)/2;
	}
	else if(a[0]<0)ans+=abs(a[0])*(abs(a[0])+1)/2;
	for(long i=1;i<n-1;i++)
	{
		if(a[i]>0)
		{
			if(abs(a[i])>abs(a[i+1]))ans+=a[i]*(a[i]+1)/2;
			else ans+=a[i]*(a[i]-1)/2;
		}
		else if(a[i]<0)
		{
			if(abs(a[i-1])>abs(a[i]))ans+=abs(a[i])*(abs(a[i])-1)/2;
			else ans+=abs(a[i])*(abs(a[i])+1)/2;
		}
	}
	if(a[n-1]>0)ans+=a[n-1]*(a[n-1]+1)/2;
	else if(a[n-1]<0)
	{
		if(abs(a[n-2])>abs(a[n-1]))ans+=abs(a[n-1])*(abs(a[n-1])-1)/2;
		else ans+=abs(a[n-1])*(abs(a[n-1])+1)/2;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 2932
while True:
    a,b = map(int, input().split())
    if a == 0 and b == 0: break

    for j in range(a):
        for i in range(b):
            if (i+j)%2==0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()


Measured memory_bytes: 7000
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
999
)");
#define cin input
#endif

int main()
{
	int k;
	cin >> k;

	int c = 0;
	int r = 0;
	bool f = false;
	string s;
	REP (i, k)
	{
		++c;
		cout << c << s << endl;
		if (c == r * 10 + 9)
		{
			c = r;
			if (f)
			{
				++r;
				if (r == 9 || r == 99)
					f = false;
			}
			else
				f = true;
			s += '9';
		}
	}
/*
	double m = 9999999999999999.;
	for (int x = 9999999; x > 0; --x)
	{
		ll i = x * 100000000ll + 99999999ll;
		int s = 0;
		for (ll j = i; j; j /= 10)
			s += j % 10;
		double d = i / (double)s;
		if (d <= m)
		{
			cout << "_" << i << " " << d << endl;
			m = d;
		}
	}
*/
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>

#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(long (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(long (i)=(a)-1;(i)>=(b);(i)--)
#define MOD 1000000007
#define PI acos(-1.0)
#define DEBUG(C) cout<<C<<endl;
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<long,long>
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).begin(),(a).end(),greater<int>())
#define MP(a,b) make_pair(a,b)
#define FORE(a,b) for(auto &&a:b)

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

int main(void){
	LL X; cin>>X;
	cout<<X*X*X<<endl;
}

Measured memory_bytes: 3088
#include <algorithm>
#include <iostream>

using namespace std;

constexpr static int MAXN = 200;
int a[MAXN];

int main() {
    int n, x;
    cin >> n >> x;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);

    int64_t total = 0;
    for (int i = 0; i < n; i++)
        total += a[i];

    int r = n;
    if (total > x) {
        int64_t sum = 0;
        for (int i = 0; i < n; i++) {
            sum += a[i];
            if (sum > x) {
                r = i;
                break;
            }
        }
    }
    if (total < x) {
        r = n - 1;
    }
    cout << r << endl;
}


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

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

    #ifdef FUNSOCIETY
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif // FUNSOCIETY

    string s; cin >> s;
    set<int> all;
    for(int i = 0; i < s.size(); i++) {
        all.insert(s[i]);
    }

    bool ok = true;
    if(all.count('N')) ok &= all.count('S');
    if(all.count('S')) ok &= all.count('N');
    if(all.count('E')) ok &= all.count('W');
    if(all.count('W')) ok &= all.count('E');

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n;
	int x[n+1]={};
	x[n]=2020;
	for(int p=0;p<n;p++){
		cin>>x[p];
	}
	//for(int p=0;p<n+1;p++){
	//	cout<<x[p]<<endl;
	//}
	cin>>m;
	int t;
	for(int p=0;p<m;p++){
		cin>>t;
		t--;
		if(x[t]+1<x[t+1]){
			x[t]++;
		}
	}
	for(int p=0;p<n;p++){
		cout<<x[p]<<endl;
	}
}


Measured memory_bytes: 3116
#include<stdio.h>
int main(void){
	int H,stone[10][5]={0};
	int a,i,j,k,score=0;

	while(1){
		scanf("%d",&H);
		if(H==0){break;}
		score=0;
		for(i=0;i<H;i++){
			scanf("%d %d %d %d %d",&stone[i][0],&stone[i][1],&stone[i][2],&stone[i][3],&stone[i][4]);	
		}
		for(a=0;a<50;a++){
			for(i=0;i<H;i++){
				if(stone[i][0]==stone[i][1]&&stone[i][1]==stone[i][2]&&stone[i][2]==stone[i][3]&&stone[i][3]==stone[i][4]){
					score+=stone[i][2]*5;
					for(j=0;j<5;j++){stone[i][j]=0;}
				}
			}
				
			for(i=0;i<H;i++){
				for(j=0;j<2;j++){
					if(stone[i][j]==stone[i][1+j]&&stone[i][1+j]==stone[i][2+j]&&stone[i][2+j]==stone[i][3+j]){
						score+=stone[i][2]*4;
						for(k=j;k<j+4;k++){stone[i][k]=0;}
					}
				}
			}

			for(i=0;i<H;i++){
				for(j=0;j<3;j++){
					if(stone[i][0+j]==stone[i][1+j]&&stone[i][1+j]==stone[i][2+j]){
						score+=stone[i][2]*3;
						for(k=j;k<j+3;k++){stone[i][k]=0;}
					}
							
				}
			}
			
			for(k=0;k<10;k++){
				for(i=1;i<H;i++){
					for(j=0;j<5;j++){
						if(stone[i][j]==0&&stone[i-1][j]!=0){
							stone[i][j]=stone[i-1][j];
							stone[i-1][j]=0;
						}
					}
				}
			}				
		}
		printf("%d\n",score);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <tuple>
typedef long long int ll;
using namespace std;
int main() {
    int primelist[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
    int num_of_prime[15];
    int n;
    cin >> n;
    for (int i = 0; i < 15; i++) {
        int n1 = n;
        int count = 0;
        while (n1) {
            n1 /= primelist[i];
            count += n1;
        }
        num_of_prime[i] = count;
    }
    int ret = 0;
    for (int i = 0; i < 15; i++) {
        if (num_of_prime[i] >= 74) {
            ret++;
        }
    }
    //cout << num_of_prime[2] << endl;
    int p1 = 0;
    int q1 = 0;
    for (int i = 0; i < 15; i++) {
        if (num_of_prime[i] >= 24) {
            p1++;
            q1++;
        }
        else if (num_of_prime[i] >= 2) {
            q1++;
        }
    }
    ret += p1 * (q1 - 1);
    int p2 = 0;
    int q2 = 0;
    for (int i = 0; i < 15; i++) {
        if (num_of_prime[i] >= 14) {
            p2++;
            q2++;
        }
        else if (num_of_prime[i] >= 4) {
            q2++;
        }
    }
    ret += p2 * (q2 - 1);
    int p3 = 0;
    int r3 = 0;
    for (int i = 0; i < 15; i++) {
        if (num_of_prime[i] >= 4) {
            p3++;
            r3++;
        }
        else if (num_of_prime[i] >= 2) {
            r3++;
        }
    }
    ret += p3 * (p3 - 1) / 2 * (r3 - 2);
    cout << ret << endl;
    return 0;
}

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

#define int long long
#define abs(n) ((n) < 0 ? -(n) : (n))
#define NOT_COLORED (-1)

const int LLINF = 1LL << 60;

struct Node {
  int color, node;
  Node(int color, int node) : color(color), node(node) {}
};

int n;
vector < int > graph[100005];
int color[100005];

signed main()
{
  int sum0, sum1;
  queue < Node > que;
  memset(color, NOT_COLORED, sizeof(color));
  
  
  cin >> n;

  for(int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b; --a, --b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  que.push(Node(0, 0));
  que.push(Node(1, n - 1));
  
  while(!que.empty()) {
    Node d = que.front(); que.pop();
    int node = d.node;

    for(int i = 0; i < graph[node].size(); i++) {
      int u = graph[node][i];
      if(color[u] == NOT_COLORED) {
	color[u] = d.color;
	que.push(Node(d.color, u));
      }
    }
  }
  
  sum0 = sum1 = 0;
  for(int i = 0; i < n; i++) {
    if(color[i] == 0) sum0++;
    else sum1++;
  }

  if(sum1 < sum0) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }

  return (0);
}
  


Measured memory_bytes: 7424
#include <stdio.h>
#pragma warning (disable:4996)

#define LANE 12

int main() {
	char S[LANE], T[LANE];
	(void)scanf("%s", S);
	(void)scanf("%s", T);
	bool ans = true;
	int i = 0;
	while (S[i] != '\0') {
		if (S[i] != T[i]) {
			ans = false;
		}
		i++;
	}
	if (T[i + 1] != '\0')ans = false;
	if (ans)printf("Yes"); else printf("No");
}

/*
#include <iostream>
#include <string>
#pragma warning (disable:4996)
using namespace std;

int main() {
	string S, T;
	scanf("%s", &S);
	scanf("%s", &T);
	int S_lane = sizeof(S) / sizeof(S.at(0));
	int T_lane = sizeof(T) / sizeof(T.at(0));
	bool ans = true;
	if (T_lane != S_lane + 1) ans = false;
	for (int i = 0; i < S_lane; i++) {
		if (S.at(i) != T.at(i)) {
			ans = false;
			break;
		}
	}
	if (ans == true)printf("Yes"); else printf("No");
}
*/

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  long long r;
  scanf("%lld", &r);

  cout << 3 * pow(r, 2) << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 256