akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N=110;
const int mod=998244353;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
string s;
map<string,int> f,g;
int F(string s);
int G(string s);
int G(string s) {
    if(g.count(s)) return g[s];
    int n=s.length(),ret=0;
    if(n==1) return g[s]=s[0]-'0'+1;
    for(int i=1;i<n;i++)
        if(n%i==0) {
            string nxt;
            for(int j=0;j<i;j++) {
                int t=1;
                for(int k=j;k<n;k+=i) t&=(s[k]-'0');
                nxt+=char(t+'0');
            }
            ret=(ret+F(nxt))%mod;
        }
    return g[s]=ret;
}
int F(string s) {
    if(f.count(s)) return f[s];
    int ret=0,n=s.length();
    if(!n) return 1;
    for(int i=1;i<=n;i++) ret=(ret+1ll*G(s.substr(0,i))*F(s.substr(i,n))%mod)%mod;
    return f[s]=ret;
}
int main() {
    cin>>s;
    cout<<F(s);
    return 0;
}


Measured memory_bytes: 12928
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する
ll mod = 1000000007;


int main() {
    int N;
    cin >> N;
    vector<int> v(N+1);

    REP(i,1,N+1){
        cin >> v[i];
    }
    int cnt = 0;
    for(int i = 1; i < v.size(); ){
        if(v[i] == i){
            if(v[i + 1] == i + 1){
                i+=2;
                cnt++;
            }else{
                i++;
                cnt++;
            }
        }else{
            i++;
        }
    }

    cout << cnt << endl;


    return 0;

}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
//#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	char a, b, c;
	cin >> a >> b >> c;
	if (a == '7' || b == '7' || c == '7') cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define fo(i,n) for(int i=0;i<n;i++)
#define rfo(i,n) for(int i=n-1;i>=0;i--)
#define Fo(i,q,n) for(int i=q;i<n;i++)
#define rFo(i,q,n) for(int i=n-1;i>=q;i--)
#define fO(i,n,k) for(int i=0;i<n;i+=k)
#define FO(i,q,n,k) for(int i=q;i<n;i+=k)
#define zero(a,n) memset(a,0,sizeof(a[0])*n)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define Endl "\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
using namespace std;
const int MOD=1000000007;
void print(){cout <<endl;}
template <typename T, typename... Types> 
void print(T var1, Types... var2){cout << var1 << " " ;print(var2...) ;}
//ceil of a/b
template <typename T>
T fceil(T a,T b){return (T)(a+b-1)/b;}
//const int N=2e5;
//int arr[N+1];

 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		cin>>n;
		int a[n];
		fo(i,n){
			cin>>a[i];	
		}
		int maxm=0;
		ll sum=0;
		fo(i,n){
			maxm = max(maxm,a[i]);
			sum+= maxm-a[i];	
		}
		cout<<sum<<endl;			
	}
	return 0;
}


Measured memory_bytes: 4384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int main() {
	int n, m;
	bool cpu[ 20000 ];
	vector<pair<int, PII> > d;
	while ( ~scanf( "%d %d", &n, &m ) && n ) {
		cpu[ 0 ] = true;
		CLR( cpu );
		cpu[ 0 ] = true;
		d.clear();
		for ( int i = 0; i < m; i++ ) {
			int time, from, to;
			scanf( "%d %d %d", &time, &from, &to );
			d.push_back( MP( time, MP( from - 1, to - 1 ) ) );
		}
		sort( d.begin(), d.end() );
		for ( int i = 0; i < m; i++ ) {
			if ( cpu[ d[ i ].second.first ] ) {
				cpu[ d[ i ].second.second ] = true;
			}
		}
		int ans = 0;
		for ( int i = 0; i < n; i++ ) {
			ans += cpu[ i ];
		}
		printf( "%d\n", ans );
	}
	return 0;
}

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


int main(){
	char list[][6]={
	{"     "},
	{".,!? "},
	{"abc  "},
	{"def  "},
	{"ghi  "},
	{"jkl  "},
	{"mno  "},
	{"pqrs "},
	{"tuv  "},
	{"wxyz "} };
	int m[10] = {1,5,3,3,3,3,3,4,3,4};
	int count,n,i,buf;
	string str;
	cin >> n;
	while(n--){
		cin >> str;
		count=0;
		for(i=0;i<str.size() && str[i]=='0';i++);
		for(;i<str.size();i++){
			if(str[i]!='0'){
				count++;
			}else{
				if(str[i-1]!='0'){
				buf = (int)str[i-1] - (int)'0';
				cout << list[buf][(count-1) % m[buf]];
				count=0;
				}else{
					count=0;
				}
			}
		}
		cout << endl;
        }
        return 0;
}

Measured memory_bytes: 1200
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
import bisect

s = input().strip()
n = len(s)
t = input().strip()
m = len(t)

pos = [[] for i in range(26)]
for i, c in enumerate(s):
    pos[ord(c) - ord("a")].append(i)

poslen = [len(p) for p in pos]

syu = 0
tmp = -1
fin = False
for c in t:
    tgt = pos[ord(c) - ord("a")]
    tlen = poslen[ord(c) - ord("a")]
    if not tgt:
        print(-1)
        sys.exit()
    else:
        ins = bisect.bisect_left(tgt, tmp+1)
        if ins == tlen:
            syu += 1
            tmp = tgt[0]
            fin = True
        else:
            # print(c, tgt, ins)
            tmp = tgt[ins]
            fin = False

        # print(c, syu, tmp)
# if fin:

print(syu*n + tmp + 1)


Measured memory_bytes: 46704
package main

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

func main() {
     sc := bufio.NewScanner(os.Stdin)
     sc.Split(bufio.ScanWords)

     var n [2]int
     for i := 0; i < len(n); i++ {
         if sc.Scan() { n[i], _ = strconv.Atoi(sc.Text()) }
     }

     fmt.Printf("%d %d\n", n[0]*n[1], n[0]*2 + n[1]*2);
}



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

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

  if (N % 10 == 3) {
    cout << "bon" << endl;
  } else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) {
    cout << "pon" << endl;
  } else {
    cout << "hon" << endl;
  }

  return 0;
}

Measured memory_bytes: 3592
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

# 解説AC
ans, num = 0,1
for i in range(60):
    cnt = sum((ai & num) >> i for ai in a)
    ans += (cnt * (n - cnt) * num) % mod
    num <<= 1
print(ans % mod)


Measured memory_bytes: 124408
q,h,s,d = map(int,input().split())
n = int(input())
s = min(s,min(q*2,h)*2)
if s*2<d:
    print(n*s)
else:
    if n%2==0:
        print((n//2)*d)
    else:
        print((n//2)*d+s)

Measured memory_bytes: 9116
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
import std.typecons, std.regex;

void main() {
    int n = read.to!int;
    long W = read.to!long;
    auto w = new long[](n);
    auto v = new int[](n);
    foreach(i; 0..n) {
        w[i] = read.to!long;
        v[i] = read.to!int;
    }
    auto dp = new long[][](n+1, v.sum+1);
    foreach(i; 0..dp.length) fill(dp[i], 1L << 60);
    dp[0][0] = 0;
    foreach(i; 0..n) {
        foreach(j; 0..v.sum+1) {
            chmin(dp[i+1][j], dp[i][j]);
            if (j+v[i] < dp[0].length) chmin(dp[i+1][j+v[i]], dp[i][j] + w[i]);
        }
    }
    int ret = 0;
    foreach(i; 0..v.sum+1) {
        if (dp[n][i] <= W) {
            ret = i;
        }
    }
    writeln(ret);
}

void chmin(T)(ref T a, T b) {
    if (a > b) a = b;
}

string read() {
    static string[] ss;
    while (!ss.length) ss = readln.chomp.split;
    auto res = ss[0];
    ss.popFront;
    return res;
}


Measured memory_bytes: 80764
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a, b, c, k;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  if (a >= k)
    printf("%d\n",k);
  else if (a + b >= k)
    printf("%d\n",a);
  else
    printf("%d\n",a - (k - a - b));
  return 0;
}


Measured memory_bytes: 3768
n = int(input())
d = [int(input()) for i in range(n)]

if sum(d)%2 > 0:
    print(-1)
    exit()

d = sorted([(dd, i) for i, dd in enumerate(d)], reverse = True)
d_to_i = {dd:i for dd, i in d}
n_child = [1]*n
d_child = [0]*n
ans = []
for dd, i in d:
    d_i = dd+2*n_child[i]-n
    if d_i in d_to_i.keys():
        i_next = d_to_i[d_i]
        ans.append((i+1, i_next+1))
        n_child[i_next] += n_child[i]
        d_child[i_next] += d_child[i] + n_child[i]
        if n_child[i_next] == n:
            break
    else:
        print(-1)
        exit()

d_min, i_min = d[-1]
if d_min == d_child[i_min]:
    for a in ans:
        print(*a)
else:
     print(-1)


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

#define PI 4*atan(1)
#define INF 1e8

typedef long long ll;

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

int main(){
  ll N, C, K;
  cin >> N >> C >> K;
  vector<int> T(N);
  for(int i = 0; i < N; i++){
    cin >> T[i];
  }
  sort(T.begin(), T.end());
  ll c = 0, ans = 0, l;
  for(int i = 0; i < N; i++){
    if(l < T[i]){
      ans++;
      l = T[i] + K;
      c = 1;
    }else{
      c++;
    }
    if(c == C){
      c = 0;
      l = 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <stdio.h>

void del(int *v, int l, int del){
  int i;
  for(i = 0; i < l - 1; i++){
    if(i >= del){
      v[i] = v[i + 1];
    }
  }
  return;
}

int slv(int *v, int v_l, int *sol, int sol_l){
  int i, j, flg;
  if(v_l == 1 && v[0] == 1){
    sol[0] = 1;
    return 1;
  }
  for(i = v_l - 1; i >= 0; i--){
    flg = 0;
    if(v[i] == i + 1){
      int newV[v_l];
      for(j = 0; j < v_l; j++){
        newV[j] = v[j];
      }
      del(newV, v_l, i);
      sol[v_l - 1] = i + 1;
      flg = slv(newV, v_l - 1, sol, sol_l);
      return flg;
    }
    //if(flg){return 1;}
    //return flg;
  }
  return 0;
}

int main(){
  int n, i;
  scanf("%d", &n);
  int b[n];
  for(i = 0; i < n; i++){
    scanf("%d", &b[i]);
  }
  int sol[n];
  for(i = 0; i < n; i++){
    sol[i] = -1;
  }
  if(slv(b, n, sol, n)){
    for(i = 0; i < n; i++){
      printf("%d\n", sol[i]);
    }
  }else{
    printf("-1\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int q, i;
    bool rev = false;
    string s;
    cin >> s >> q;
    for(i=0; i<q; i++){
        int t;
        cin >> t;
        if(t == 1)
            rev = !rev;
        else{
            int f;
            char c;
            cin >> f >> c;
            if(f == 1){
                if(!rev)
                    s.insert(0, 1, c);
                else
                    s += c;
            }
            else{
                if(!rev)
                    s += c;
                else
                    s.insert(0, 1, c);
            }
        }
    }
    if(rev)
        reverse(s.begin(), s.end());
    cout << s << '\n';
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  int red = count(s.begin(), s.end(), '0');
  int blue = count(s.begin(), s.end(), '1');
  cout << 2*min(red, blue) << endl;
  return 0;
}

Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	s := next()

	ans := n
	w := 0
	b := 0
	cw := true

	for i := 0; i < n; i++ {
		if s[i] == '.' {
			w++
		}
	}

	if w == 0 {
		fmt.Fprintln(out, 0)
		return
	}

	for i := 0; i < n; i++ {
		if (cw && s[i] == '#') || ((!cw) && s[i] == '.') {
			if cw {
				ans = minInt(ans, b+w)
			}
			cw = !cw
		}

		if s[i] == '#' {
			b++
		} else {
			w--
		}
	}

	ans = minInt(ans, b+w)

	//99999

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)
}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}


Measured memory_bytes: 1152
// ராஜ்_ஆர்ட்டன்

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

void solve() {
	
	int n, k;
	cin >> n >> k;
	
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	
	int ans = 0;
	for(int i = 0; i < k; i++) {
		ans += a[i];
	}
	cout << ans << endl;
}

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cerr.tie(0);
	// int t; cin >> t; for(int i = 1; i <= t; i++) //cout << "Case #" << i << ": ",
	solve();
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

using namespace std;

typedef long long ll;

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 main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n; cin>>n;
  int a[n];
  
  rep(i,n) {
    cin>>a[i];
  }
  
  int tap = 1;
  int ans = 0;
  
  rep(i,n) {
    tap = a[tap-1];
    ++ans;
    
    if (tap==2) {
      cout<<ans;
      return 0;
    }
  }
  
  cout<<-1;
}

Measured memory_bytes: 4020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll H,W,N;
    cin>>H>>W>>N;
    map<Pi,ll>m;
    rep(i,N){
        ll a,b;
        cin>>a>>b;
        rep(j,3){
            rep(k,3){
                m[mp(a+j,b+k)]++;
            }
        }

    }
    vector<ll>ans(10);
    ll sum=0;
     for (const auto& [key, value] : m){
        if(key.first<=H&&key.second<=W && key.first>2&&key.second>2){
            ans[value]++;
            sum++;
        }
    }
    ans[0]=(H-2)*(W-2)-sum;

    rep(i,10){
        cout<<ans[i]<<endl;
    }

    return 0;
    

}

Measured memory_bytes: 59804
#include <bits/stdc++.h>
using namespace std;
int main(){
  int c;
string s;
  cin>>s;
  if(s=="RSR"||s=="RSS"||s=="SSR"||s=="SRS")c=1;
  else if(s=="RRR"){c=3;}
  else if(s=="SSS"){c=0;}
  else c=2;
  cout<<c;

return 0;
}

Measured memory_bytes: 3556
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        long k=sc.nextLong();
        sc.close();
        long q=k/50;
        long r=k%50;
        System.out.println(50);
        for(int i=0;i<50;i++){
            System.out.print((q+(i<50-r?49-r:100-r))+" ");
        }
    }
}

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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

char s[100][100];

int cnt(int y, int x) {
  int cnt = 0;
  for (int i = y - 1; i <= y+1; ++i) {
    for (int j = x - 1; j <= x+1; ++j) {
      if (i == y && j == x) continue;
      if (s[i][j] == '#') ++cnt;
    }
  }
  return cnt;
}

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

  int h, w;
  cin >> h >> w;

  for (int i = 0; i <= h+1; ++i) {
    for (int j = 0; j <= w+1; ++j) {
      s[i][j] = '.';
    }
  }

  for (int i = 1; i <= h; ++i) {
    for (int j = 1; j <= w; ++j) {
      cin >> s[i][j];
    }
  }

  for (int i = 1; i <= h; ++i) {
    for (int j = 1; j <= w; ++j) {
      if (s[i][j] == '#') cout << '#';
      else cout << cnt(i, j);
    }
    cout << "\n";
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define INF (int) 2e9
#define MOD (int) 1e9 + 7


int main(){
    int h, w;
    cin >> h >> w;
    char a[h][w];
    rep(i, h){
        rep(j, w){
            cin >> a[i][j];
        }
    }

    int dp[1005][1005] = {};

    dp[0][0] = 1;

    rep(i, h){
        rep(j, w){
            if(a[i][j]=='.'){
                if(i>0){
                    dp[i][j] += dp[i-1][j]; 
                    dp[i][j] %= MOD;
                }
                if(j>0){
                    dp[i][j] += dp[i][j-1]; 
                    dp[i][j] %= MOD;
                }
            }else{
                dp[i][j] = 0;
            }
        }
    }

    cout << dp[h-1][w-1] << endl;
    return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
void solve(std::string S){
    bool s1 = S[0] == 'R';
    bool s2 = S[1] == 'R';
    bool s3 = S[2] == 'R';
	if( s1 && s2 && s3){
      cout << 3 << endl;
    } else if(!( s1 || s2 || s3)){
      cout << 0 << endl;
    } else if(s2 && (s1 || s3)){
      cout << 2 << endl;
    } else {
      cout << 1 << endl;
    }
}
 
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}

Measured memory_bytes: 3600
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
res = 0

res = max(b)+a[1]
for i in range(1, len(b)):
    res -= abs(b[i]-b[i-1])-a[1] if abs(b[i]-b[i-1])-a[1] > 0 else 0

print(res)


Measured memory_bytes: 25200
def binarySearch(S,key):
    left = 0
    right = n
    while left < right:
        mid = int((left + right)/2)
        if S[mid] == key:
            return True
        elif key < S[mid]:
            right = mid
        else:
            left = mid + 1

#%%
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

#%%
sum = 0

for i in range(q):
    if binarySearch(S,T[i]) == True:
        sum += 1
        
print(sum)


Measured memory_bytes: 16708
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a == 0 || b == 0 ){
    cout << "Zero" << endl;
  }
  else if(a<0 && b>0){
    cout << "Zero" << endl;
  }
  else if(a>0&&b>0){
    cout << "Positive" <<endl;
  }
  else if((b-a)%2 == 1){
    cout <<"Positive" <<endl;
  }
  else{
    cout << "Negative" << endl;
  }

}

Measured memory_bytes: 256
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, max, min, sum;
            while ((n = int.Parse(Console.ReadLine())) != 0)
            {
                sum = max = 0;
                min = int.MaxValue;

                for (int i = 0; i < n; i++)
                {
                    var s = int.Parse(Console.ReadLine());
                    sum += s;
                    if (s > max) max = s;
                    if (s < min) min = s;
                }

                Console.WriteLine((sum - max - min) / (n - 2));
            }
        }
    }
}

Measured memory_bytes: 5580
#include<algorithm>//sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric>
// xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include<queue>//priority_queue<型名> 変数
#include<set>
#include<stack>
#include<string>//変数.substr(どこから,いくつ)
#include<vector>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
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 main(){
  ll n,a,b; cin >> n >> a >> b;
  if(n == 1){
    if(a == b){
      cout << 1;
    }else{
      cout << 0;
    }
  }else{
    if(a > b){
      cout << 0;
    }else{
      cout << (n-2)*(b-a)+1;
    }
  }
  cout << "\n";
  return 0;
}


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

using namespace std;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int maxn = 105;

char s[maxn];
ll answer = 0;
int n, k;

inline void add(ll x, ll times = 1)
{
	answer += (x / 2) * times;
}

void solve(int l, int r, ll times)
{
	int cur = 1;
	for (int i = l + 1; i < r + 1; i++)
	{
		if (s[i] == s[i - 1]) cur++;
		else
		{
			add(cur, times);
			cur = 1;
		}
	}
	add(cur, times);
}

int main()
{
	scanf("%s", s);
	n = strlen(s);
	scanf("%d", &k);
	
	if (s[0] != s[n - 1])
	{
		solve(0, n - 1, k);
		cout << answer << endl;
		return 0;
	}
	
	int st = 0;
	while (s[st] == s[0]) st++;
	if (st == n)
	{
		add((ll)n * k);
		cout << answer << endl;
		return 0;
	}
	add(st);
	int fn = n - 1;
	while (s[fn] == s[n - 1]) fn--;
	add(n - 1 - fn);
	solve(st, fn, k);
	add(st + (n - 1) - fn, k - 1);
	cout << answer << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

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

  int N, K;
  cin >> N >> K;
  char A[K];
  map<char, int> mp;
  rep(i,K){
    cin >> A[i];
    mp[A[i]]++;
  }
  while(true){
    bool ok = true;
    string S = to_string(N);
    for(int i=0;i<S.size();i++){
      if(mp[S[i]] == 1) ok = false;
    }
    if(ok) break;
    N++;
  }
  cout << N << endl;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N, M;
	cin>>N>>M;
	vector<int> h(N);
	for (auto &i : h){
		cin>>i;
	}
	vector<vector<int>> road(N);
	for (int i = 0; i < M; ++i){
		int a, b;
		cin>>a>>b;
		road[a-1].push_back(b-1);
		road[b-1].push_back(a-1);
	}
	int res = 0;
	for (int i = 0; i < N; ++i){
		bool ok = true;
		for (auto j : road[i]){
			ok &= h[j] < h[i];
		}
		if (ok) ++res;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 8744
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
//<DEFINE>
void Fast() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
}
void File() {
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#ifdef _WIN64
#define __builtin_popcountll __popcnt64
#else
inline int __builtin_popcountll(__int64 a) {
	return __builtin_popcount((unsigned int)a) + __builtin_popcount(a >> 32);
}
#endif
#endif
using ll = long long;
using ull = unsigned long long;
#define mod 1000000007
ll gcd(ll a, ll b) {
	return!b ? a : gcd(b, a % b);
}
#define fix(n) cout << fixed << setprecision(n);
#define all(a) a.begin(), a.end()
#define skip continue
#define stop(n) return cout<<n,0
#define pi  acos(-1)
#define endl "\n"
#define ceil(x,y) (x+y-1)/y//be careful from the multiplication while using this define 
#define TC int t;cin>>t;while(t--)
//</DEFINE>
//<FUNCTIONS>
//</FUNCTIONS>	
int main() {
	Fast(), File();
	int n, cpcty;
	cin >> n >> cpcty;
	vector<vector<ll>>dp(n, vector<ll>(cpcty + 1));
	vector<pair<ll, ll>>v(n);
	for (int i = 0; i < n; i++)cin >> v[i].first >> v[i].second;
	for (int i = v[n - 1].first; i <= cpcty; i++)dp[n - 1][i] = v[n - 1].second;
	for (int i = n - 2; i >= 0; i--) {
		for (int j = 1; j <= cpcty; j++) {
			if (j >= v[i].first)dp[i][j] = max(dp[i + 1][j - v[i].first] + v[i].second, dp[i + 1][j]);
			else dp[i][j] = dp[i + 1][j];
		}
	}
	cout << dp[0][cpcty] << endl;
}

Measured memory_bytes: 82272
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
const int N=1e5+4;
int a[N];
int32_t main()
{
	int n=in();
	for(int i=1;i<=n;i++)a[i]=in();
	sort(a+1,a+n+1);
	
	int cur=0,sum=0;
	for(int i=1;i<=n;i++)
	{
		sum+=a[i];
		if(sum*2<a[i+1])cur=i;
	}
	cout<<n-cur;
}


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

int main() {
    int N, A[2][100];
    long num, num_max = 0;
    cin >> N;
    for (int j = 0; j < N; j++) {
        cin >> A[0][j];
    }
    for (int j = 0; j < N; j++) {
        cin >> A[1][j];
    }

    for (int i = 0; i < N; i++) {
        num = 0;
        for (int j = 0; j <= i; j++) {
            num += A[0][j];
        }
        for (int j = i; j < N; j++) {
            num += A[1][j];
        }

        if (num > num_max) num_max = num;
    }
    cout << num_max << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int i,cou=0,a,b,c;
	do{
		scanf("%d %d %d",&a,&b,&c);
	}while(a<1 || a>10000 || b<1 || b>10000 || c<1 || c>10000 || b<a);

	for(i=a;i<=b;i++){
		if(c%i == 0)
			cou++;
	}
	printf("%d\n",cou);
	return 0;
}

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

#define MAX_N 100

int main() {
    int N;
    cin >> N;
    int A[2][MAX_N];
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < N; j++) {
            cin >> A[i][j];
        }
    }
    int max_val = 0;
    for (int cp = 0; cp < N; cp++) {
        int sum_val = 0;
        int i = 0;
        for (int j = 0; j < N; j++) {
            sum_val += A[i][j];
            if (j == cp) {
                i += 1;
                sum_val += A[i][j];
            }
        }
        max_val = sum_val > max_val ? sum_val : max_val;
    }
    cout << max_val << endl;
    return 0;
}


Measured memory_bytes: 256
N, *P = map(int, open(0).read().split())

idx_dict = [0] * (N + 1)
for i in range(N):
    idx_dict[P[i]] = i + 1

cnt = 0
l = [0] + [i for i in range(N + 1)]
r = [i + 1 for i in range((N + 1))] + [N + 1]

for v in range(1, N + 1):
    i = idx_dict[v]
    
    l1 = l[i]
    l2 = l[l1]
    r1 = r[i]
    r2 = r[r1]
    cnt += ((l1 - l2) * (r1 - i) + (i - l1) * (r2 - r1)) * v
    
    l[r1] = l1
    r[l1] = r1
    
print(cnt)


Measured memory_bytes: 60728
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int main()
{
int a,num=0;
cin>>n;
for(int i=1;i<=n;++i){
cin>>a;
if(a%2==1) num++;
}
if(num%2==1) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n;
  ll a,b;
  pair<ll,ll> p[200000];
  ll po[200000],pi[200000];
  rep(i,200000) pi[i]=po[i]=0;
  cin>>n;
  rep(i,n){
    cin>>a>>b;
    p[i*2]=make_pair(a,1);
    p[i*2+1]=make_pair(b+1,-1);
  }
  sort(p,p+(n*2));
  int j=0;
  rep(i,n*2){
    if(i==0 || po[j]==p[i].first){
      po[j]=p[i].first;
      pi[j]+=p[i].second;
    }
    else{
      j++;
      po[j]=p[i].first;
      pi[j]+=p[i].second;
    }
  }
  rep(i,8){
    //cout<<po[i]<<" "<<pi[i]<<endl;
    }
  ll ans=0;
  ll now=0;
  rep(i,200000){
    now+=pi[i];
    ans=max(ans,now);
  }
  cout<<ans<<endl;
  int nn=1000000000;
  // cout<<nn<<endl;
  return 0;
}






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

#include <cmath>
using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    int R;
    cin >> R;
    cout << 2 * R * M_PI << endl;
    return 0;
}

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

using namespace std;

int main()
{
  int64_t k, x;
  cin >> k >> x;

  for(int64_t i = x - k + 1;
      i < x + k;
      ++i)
    {
      cout << i << " ";
    }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int a, b;
    cin >> a >> b;
    if (a < 10 && b < 10) cout << a * b << endl;
    else cout << -1 << endl;
    return (0^_^0);
}



Measured memory_bytes: 768
#include <stdio.h>
#include <algorithm>

#define MAX 100000

struct TRAMP{
	char mark;
	int number;
};

TRAMP cards[MAX];

struct Node{
	Node(){
		number = 0;
		mark_array_index = 0;
		l_p = r_p = p_p = -1;
	}
	int number, mark_array_index,l_p,r_p,p_p;
	char mark_array[5];
};

class Tree{
public:
	Tree(int n){
		num_of_nodes = 0;
		nodes = new Node[n];
	};
	~Tree(){
		delete[] nodes;
	}
	void push(TRAMP data){
		int t = 0;
		while(true){
			if(num_of_nodes == 0){
				nodes[num_of_nodes].number = data.number;
				nodes[num_of_nodes].mark_array[nodes[num_of_nodes].mark_array_index++] = data.mark;
				num_of_nodes++;
				break;
			}else{
				if(nodes[t].number == data.number){
					nodes[t].mark_array[nodes[t].mark_array_index++] = data.mark;
					break;
				}else if(nodes[t].number > data.number){
					if(nodes[t].l_p == -1){
						nodes[t].l_p = num_of_nodes;
						nodes[num_of_nodes].p_p = t;
						nodes[num_of_nodes].number = data.number;
						nodes[num_of_nodes].mark_array[nodes[num_of_nodes].mark_array_index++] = data.mark;
						num_of_nodes++;
						break;
					}else{
						t = nodes[t].l_p;
					}
				}else{
					if(nodes[t].r_p == -1){
						nodes[t].r_p = num_of_nodes;
						nodes[num_of_nodes].p_p = t;
						nodes[num_of_nodes].number = data.number;
						nodes[num_of_nodes].mark_array[nodes[num_of_nodes].mark_array_index++] = data.mark;
						num_of_nodes++;
						break;
					}else{
						t = nodes[t].r_p;
					}
				}
			}
		}
	}

	bool compare(int cards_index){
		int k = 0,number = cards[cards_index].number,t=0;

		while(true){
			if(nodes[t].number == number)
				break;
			else{
				t = (nodes[t].number > number) ? nodes[t].l_p:nodes[t].r_p;
			}
		}

		while(number == cards[cards_index].number){
			if(cards[cards_index].mark != nodes[t].mark_array[k])
				return false;
			else{
				cards_index++;
				k++;
			}
		}
		return true;
	}

private:
	int num_of_nodes;
	Node* nodes;
};


int n;

int Partition(int left,int right){
	int i = left-1,pivot = cards[right].number;
	for(int start = left; start < right; start++){
		if(cards[start].number <= pivot){
				i++;
				std::swap(cards[i],cards[start]);
		}
	}

	std::swap(cards[i+1],cards[right]);

	return i+1;
}

void quickSort(int left,int right){
	if(left < right){
		int q = Partition(left,right);
		quickSort(left,q-1);
		quickSort(q+1,right);
	}
}


int main(){

	bool stableFLG = true;
	scanf("%d",&n);
	Tree tree(n);

	for(int i = 0; i < n; i++){
		scanf("%s %d",&cards[i].mark,&cards[i].number);
		tree.push(cards[i]);
	}

	quickSort(0,n-1);

	int history = 0;
	for(int i = 1; i < n; i++){
		if(cards[history].number != cards[i].number || i == n-1){
			if(!tree.compare(history)){
				stableFLG = false;
				break;
			}else{
				history = i;
			}
		}
	}

	if(stableFLG){
		printf("Stable\n");
	}else{
		printf("Not stable\n");
	}

	for(int i = 0; i < n; i++)	printf("%c %d\n",cards[i].mark,cards[i].number);
}

Measured memory_bytes: 4436
#include <iostream>
using namespace std;
int a,b,tp;

int main()
{
 cin>>a>>b;
 tp=0;
 if(a==1){
   tp+=300000;
 }else if(a==2){
  tp+=200000;
 }else if(a==3){
 tp+=100000;
 }
 if(b==1){
  tp+=300000;
 }else if(b==2){
  tp+=200000;
 }else if (b==3){
  tp+=100000;
 }
 if (a==1&&b==1)
 	tp+=400000;
 cout<<tp;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

static const char *peropero = "AIZUNYAN";

main {
  string s;
  cin >> s;
  if (s.size() < 8) {
    cout << s << endl;
    return 0;
  }
  rep(i, s.size() - 7) {
    unordered_map<char, int> v;
    loop(j, i, i + 8) v[s[j]]++;
    if (v['A'] == 2 && v['I'] == 1 && v['N'] == 2 && v['U'] == 1 && v['Y'] == 1 && v['D'] == 1) {
      rep(j, 8) s[i + j] = peropero[j];
      i += 7;
    }
  }
  cout << s << endl;
}

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

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll mod = 1000000007;

int n;
ll a, b;
vector<ll> h;



bool chack(ll num){
	ll sum = b * num;
	ll k = a - b;
	ll cnt = 0;
	for(int i = 0; i < n; i++){
		if(h[i] - sum <= 0)continue;
		ll acc = h[i] - sum;
		cnt += (acc + k - 1) / k;
	}
	return cnt <= num;
}

int main()
{
	cin >> n >> a >> b;	
	h.resize(n);
	for(int i = 0; i < n; i++)cin >> h[i];
	ll lef = 0, rig = 2000000000LL; //xxoooooo

	while(rig - lef > 1){
		ll mid = (rig + lef) / 2;
		(chack(mid) ? rig : lef) = mid;

	}

	std::cout << rig << endl;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int n;
	cin>>n;
	vector<long long int> v;
	while(n--){
		long long int h;
		cin>>h;
		v.push_back(h);
	}
	vector<long long int> minn;
	minn.push_back(0);
	minn.push_back(v[0]);
	for(long long int i=1;i<v.size();i++){
		minn.push_back(max(v[i],minn[i]));
	}
	long long int c=0;
	for(long long int i=1;i<v.size();i++){
		if(v[i]>=minn[i]){
			c++;
		}
	}
	cout<<c+1;
	return 0;
}

Measured memory_bytes: 3504
# coding: utf-8
import math
# Your code here!
a,b,x = map(int,input().split())

if a*b/2 < x/a:
    p = x*2/(a*a)-b
    n= b-p
    
    ans = math.degrees(math.atan(n/a))
else:
    n = 2*x/(a*b)
    ans = math.degrees(math.atan(b/n))
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int x,t;
  cin>>x>>t;
  cout<<max(x-t,0)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
	int t,cnt;
	string s,cp;
	cin>>cnt;
	cin>>s;
	cp=s;
	t=s.size();
	for(int i=0;i<t;i++){		
		if(s[i]+cnt>'Z')cp[i]=s[i]+cnt-'Z'-1+'A';
		else cp[i]=s[i]+cnt;
	}
	for(int i=0;i<t;i++)cout<<cp[i];
	cout<<"\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>

int dp[50001];
const int INF = 114514;

int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int c[m];
    for(int j=0; j<m; j++){
        scanf("%d\n", &c[j]);
    }

    // initialize dp table
    dp[0] = 0;
    for(int i=1; i<=n; i++){
        dp[i] = INF;
    }
    for(int l=0; l<m; l++){
        for(int k=c[l]; k<=n; k++){
            dp[k] = std::min(dp[k], dp[k - c[l]] + 1);
        }
    }
    printf("%d\n",dp[n]);

    return 0;
}

Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
int n;
 
int main(){
    cin >> n;
    vector<string> s(n);
    int a = 0,b = 0,ba = 0,ct = 0;
    rep(i,n){
        cin >> s[i];
        if(s[i].back()=='A' && s[i].front() == 'B') ba++;
        if(s[i].back()=='A') a++; 
        if(s[i].front()=='B') b++;
        rep(j,sz(s[i])-1){
            if(s[i].substr(j,2)=="AB") ct++;
        }
    }
    
    if(a==ba && b == ba && ba!=0) ct--;
    cout << ct+ min(a,b) <<endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
char ca[100005];
int main(){
	int a,b,c;
	int i,j,k;
	cin>>ca;
	a=0,b=0;
	for(i=0;i<strlen(ca);i++){
		if(ca[i]=='0')a++;
		else b++;
	}
	cout<<min(a,b)*2<<endl;
	return 0;
}


Measured memory_bytes: 384
h, w = map(int, input().split())
if h % 3 == 0 or w % 3 == 0:
    ans = 0
else:
    ans = 10 ** 9
    for _ in range(2):
        for i in range(1, w):
            c1 = h * i
            c2 = (h // 2) * (w - i)
            c3 = h * w - c1 - c2
            maxc = max(c1, c2, c3)
            minc = min(c1, c2, c3)
            if maxc - minc < ans:
                ans = maxc - minc
        h, w = w, h
    if ans > min(h, w):
        ans = min(h, w)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	}
}

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

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

int main()
{
    int i, n, A[10000 + 1], q, key, sum = 0;

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

    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &key);
        if( search( A, n, key) ) sum++;
    }
    printf("%d\n", sum);


    return 0;
}



Measured memory_bytes: 2108
n,T = map(int,input().split())
s = input()
ans = 0

for c in s:
	if c<='9' and c>='0':
		ans = ans + pow(n,ord(c)-ord('0'))

ans = ans*T
if ans <= 1000000000:
	print(ans)
else:
	print("TLE")




Measured memory_bytes: 5596
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long int
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int ar[3][3],ar3[3][3];

            int n,i,j;
            for(i=0;i<3;++i)
            {
                for(j=0;j<3;++j)
                    cin>>ar[i][j];
            }
            cin>>n;
            map<int,int> mp;
            for(i=1;i<=n;++i)
            {
                cin>>j;
                mp[j]=1;
            }
            for(i=0;i<3;++i)
            {
                for(j=0;j<3;++j)
                {
                    ar3[i][j]=mp[ar[i][j]];
                }
            }
            for(i=0;i<3;++i)
                for(j=0;j<3;++j)
                    ar[i][j]=ar3[i][j];
            int flag=0;
            for(i=0;i<3;++i)
            {
                if(ar[i][0]==1 && ar[i][1]==1 && ar[i][2]==1)
                    flag=1;
            }

            for(i=0;i<3;++i)
            {
                if(ar[0][i]==1 && ar[1][i]==1 && ar[2][i]==1)
                    flag=1;
            }

            if(ar[0][0]==ar[1][1] && ar[0][0]==ar[2][2] && ar[0][0]==1)
                flag=1;
            if(ar[0][2]==1 && ar[1][1]==1 && ar[2][0]==1)
                flag=1;

            if(flag)
                cout<<"Yes"<<endl;
            else
                cout<<"No"<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256