akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
typedef pair<int,int> P;
int N;
int map[100][100];
P edge[100][100];
bool rec(int c,int x,int y){
     if(c==map[x][y])return true;
     if(map[x][y]>0)return false;
     map[x][y]=c;
     return rec(c,edge[x][y].second,edge[x][y].first);
}
int main(){
     while(cin>>N,N){
	  for(int i=0;i<N;i++){
	       for(int j=0;j<N;j++){
		    map[i][j]=0;
	       }
	  }
	  for(int i=0;i<N;i++){
	       for(int j=0;j<N;j++){
		    P t;
		    cin>>t.first>>t.second;
		    edge[i][j]=t;
	       }
	  }
	  int c=1,ans=0;
	  for(int i=0;i<N;i++){
	       for(int j=0;j<N;j++){
		    if(rec(c,i,j))ans++;
		    c++;
	       }
	  }
	  /*for(int i=0;i<N;i++){
	       for(int j=0;j<N;j++){
		    cout<<map[i][j];
	       }
	       cout<<endl;
	       }*/
	  cout<<ans<<endl;
     }
}

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

ans=float("inf")
for i in range(len(S)):
    tmp=0
    for j in range(len(T)):
        if i+j>=len(S):
            break
        if S[i+j]==T[j]:
            continue
        else:
            tmp+=1
    else:
        ans=min(ans,tmp)
print(ans)



Measured memory_bytes: 67564
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stdio.h>

int main(void){
  std::string in;
  std::cin >> in;

  if(in=="ABC"){
    std::cout << "ARC";
  }else{
    std::cout << "ABC";
  }
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int main(void){
    
    int a,b,c,d,e,f,g,h,i,j;
    cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
    cout<<a+b+c+d+e+f+g+h+i+j<<endl;
    
    
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b){if (a < b) { a = b; return true; } return false;}
template<class T> inline bool chmin(T& a, T b){if (a > b) { a = b; return true; } return false;}

ll INF = 1e+18;
int iINF = 1e9;
int MAXI = 1e8 + 1;
using vec = vector<int>;

int 
main()
{
  int N, W; cin >> N >> W;
  vec w(N);
  vec v(N);
  rep(i, 0, N) cin >> w[i] >> v[i];
  vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));

  rep(i, 0, N){
    repe(k, 0, W){
      if(w[i] > k){
        dp[i + 1][k] = dp[i][k];
        continue;
      }
      if(dp[i][k] < dp[i][k - w[i]] + v[i]) dp[i + 1][k] = dp[i][k - w[i]] + v[i];
      else dp[i + 1][k] = dp[i][k];
    }
  }

  cout << dp[N][W] << endl;

}

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

const long long inf = (long long) 1e18;

int A[3003];
long long dp[3003][3003];

long long solve(int L, int R, int f)
{
    if(L == R)
        return A[L] * f;
    
    if(dp[L][R] != inf)
        return dp[L][R];
    
    long long ans = 0;
    
    if(f == 1)
    {
        ans = -inf;
        ans = max(ans, solve(L+1, R, -1) + A[L]);
        ans = max(ans, solve(L, R-1, -1) + A[R]);
    }
    else
    {
        ans = inf;
        ans = min(ans, solve(L+1, R, 1) - A[L]);
        ans = min(ans, solve(L, R-1, 1) - A[R]);
    }
    
    return dp[L][R] = ans;
}

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);
    
    int N;
    cin >> N;
    
    for(int i=1; i<=N; i++)
        cin >> A[i];
    
    for(int i=1; i<=N; i++)
        for(int j=i; j<=N; j++)
            dp[i][j] = inf;
    
    cout << solve(1, N, 1) << "\n";
    return 0;
}

Measured memory_bytes: 70144
N = int(input())
X = []
for i in range(N):
    X.append(input())

AC = 0
WA = 0
TLE = 0
RE = 0

for s in X:
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    elif s == 'RE':
        RE += 1


print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))

Measured memory_bytes: 16236
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  string S;
  cin >> S;
  int cnt = 0;
  rep(i, (S.size()+1)/2) {
    if(S[i] != S[S.size()-1-i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main(){
    int k,x;
    cin>>k>>x;
    if(500*k>=x)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map(fun x -> int x)
let char2String(value) = List.ofSeq value |> List.toArray |> System.String

let n, a, b = readIntArray() |> fun x -> (x.[0], x.[1], x.[2])
min (n * a) b
|> printfn "%d"

Measured memory_bytes: 14044
n = int(input())
p = list(map(int, input().split()))
q = [0]*n

for i, x in enumerate(p):
    q[i] = i + 1 - x

ans=0
for i in range(n):
    if q[i]==0:
        if i==n-1:
            q[i], q[i-1] = q[i-1]+1, q[i]-1
            ans+=1
        else:
            q[i], q[i+1] = q[i+1]-1, q[i]+1
            ans += 1

print(ans)

Measured memory_bytes: 14008
#include<iostream>

using namespace std;

int main()
{
	int a = 0, b = 0;
	
	cin >> a >> b;
	
	if(a < b)
		cout << "a < b" << endl;
	else if(a > b)
		cout << "a > b" << endl;
	else
		cout << "a == b" << endl;
	
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <tuple>

using namespace std;
typedef long long ll;

int N;
string S;
int X, Y;
std::vector<int> d;
std::vector<int> dx;
std::vector<int> dy;

bool ok(std::vector<int> &dx, int goal_x, bool y) {
    int m = dx.size();
    vector<unordered_map<int, bool> > dp(m);
    int min, max;
    if (m == 0) return goal_x == 0;
    dp[0][dx[0]] = true;
    min = max = dx[0];
    if (y) {
        dp[0][-dx[0]] = true;
        min = -dx[0];
    }
    for (int i = 1; i < m; i ++) {
        min -= dx[i];
        max += dx[i];
        for (int x = min; x <= max; x ++) {
            dp[i][x] = (dp[i-1][x - dx[i]] || dp[i-1][x + dx[i]]);
        }
    }
    return dp[m-1][goal_x];
}

signed main() {
    getline(cin, S);
    N = S.size();
    cin >> X >> Y;
    int x = 0;
    for (int i = 0; i < N; i ++) {
        if (S[i] == 'T') {
            d.push_back(x);
            x = 0;
        } else if (S[i] == 'F') {
            x ++;
        }
    }
    d.push_back(x);
    int m = d.size();

    for (int i = 0; i < m; i ++) {
        if (i % 2 == 0) {
            dx.push_back(d[i]);
        } else {
            dy.push_back(d[i]);
        }
    }
    cout << (ok(dx, X, false) && ok(dy, Y, true) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 492504
// https://atcoder.jp/contests/abc074/tasks/arc083_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d, e, f;
    int maxa = 0, maxb = 0;
    double maxv = -10;
    cin >> a >> b >> c >> d >> e >> f;
    // 水を入れる量
    for (int i = 0; i <= 30; i++) {
        for (int j = 0; (a * i + b * j) * 100 <= f; j++) {
            int water = a * i + b * j;
            for (int k = 0; c * k <= water * e; k++) {
                for (int l = 0; c * k + d * l <= water * e; l++) {
                    int suger = c * k + d * l;
                    double nou = (double)suger / (water * 100 + suger);
                    if (suger + water * 100 > f)
                        break;
                    if (nou > maxv) {
                        maxv = nou;
                        maxa = water * 100;
                        maxb = suger;
                    }
                }
            }
        }
    }
    cout << maxa + maxb << " " << maxb << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100000
int A[N];

int Partition(int A[],int p,int r){
  int x,i,j,tmp;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }
  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;

  return i+1;
}

int main(){
  int i,k,n,p;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  p=Partition(A,0,n-1);

  for(i=0;i<n;i++){
    if(i==p)printf("[");
    printf("%d",A[i]);
    if(i==p)printf("]");
    if(i!=n-1)printf(" ");
  }
  printf("\n");
}



Measured memory_bytes: 2124
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	w := nextStr()
	num := map[byte]int{}

	for i := 0; i < len(w); i++ {
		num[w[i]]++
	}

	for _, l := range num {
		if l%2 == 1 {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>





using namespace std;
int main() {
	
	int a, b;
	cin >> a >> b;
	if (b%a)cout << b - a << endl;
	else cout<< b + a << endl;

	return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    if "RRR" in S:
        ans = 3
    elif "RR" in S:
        ans = 2
    elif "R" in S:
        ans = 1
    else:
        ans = 0

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9024
/**
 * Created by hiramekun at 15:09 on 2019-09-26.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */
vl calculate_z(const string &input) {
    ll n = input.size();
    vl z(n);
    ll l = 0, r = 0;
    for (ll i = 1; i < n; ++i) {
        if (i > r) {
            l = r = i;
            while (r < n && input[r] == input[r - l]) r++;
            z[i] = r - l;
            r--;
        } else {
            ll i1 = i - l;
            if (z[i1] < r - i + 1) {
                z[i] = z[i1];
            } else {
                l = i;
                while (r < n && input[r] == input[r - l]) r++;
                z[i] = r - l;
                r--;
            }
        }
    }
    return z;
}

vl calc_match(const string &a, const string &pattern) {
    string s = pattern + "$" + a;
    vl z = calculate_z(s);
    vl ret;
    for (ll i = pattern.size() + 1; i < z.size(); ++i) {
        ret.eb(z[i]);
    }
    return ret;
}

void solve() {
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll ans  = 0;
    rep(i, n) {
        string pattern = s.substr(i, n - i);
        string a = s.substr(0, i);
        if (pattern.empty() || a.empty()) continue;
        vl tmp = calc_match(a, pattern);
        ans = max(ans, *max_element(all(tmp)));
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<ll> v1;
typedef vector<v1> v2;
typedef vector<v2> v3;

typedef unordered_map<ll, unordered_map<ll, ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

ll n;
unordered_map<ll,ll> d;
ll m;
ll t;

void error(){
    cout << "NO" << endl;
    exit(0);
}

int main(){
    cin >> n;
    for(ll i = 0;i < n;i++){
        ll d_;
        cin >> d_;
        d[d_]++;
    }
    cin >> m;
    for(ll i = 0;i < m;i++){
        cin >> t;
        if(d[t] > 0){
            d[t]--;
        }else{
            error();
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 11480
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream &operator << (ostream& out,const pair<S,T>& o){
    out << "(" << o.first << "," << o.second << ")"; return out;
}

/*
<url:https://arc066.contest.atcoder.jp/tasks/arc066_b>
問題文============================================================
正の整数 N が与えられます。
 2 つの整数 u,v(0≦u,v≦N) であって、ある非負整数 a,b が存在して、a xor b=u、a+b=v
 となるようなものが何通りあるかを求めてください。
 ここで、xor はビットごとの排他的論理和を表します。
 なお、答えは非常に大きくなることがあるので、10^9+7 で割った余りを求めてください。
 1≦N≦10^18
=================================================================

解説=============================================================
 解説を見た( http://kmjp.hatenablog.jp/entry/2017/01/11/1000 )
 
 制約の大きい数え上げは　桁dpやメモ化再帰の可能性が高い
 
 上からu,vの各桁の0,1を決めて行くメモ化再帰
================================================================
*/
const ll MOD = 1e9+7;
ll N;
ll memo[64][5][5];
void init(){
    for(int i = 0; i < 64;i++)for(int j = 0; j < 5;j++)for(int k = 0; k < 5;k++) memo[i][j][k] = -1;
}
ll dfs(int d,int a,int b){
    if(d < 0) return 1;
    ll& ret = memo[d][a][b];
    if(ret != -1) return ret;
    ret = 0;
    
    if(N&(1LL<<d)){ // d 桁目が 1
        ret += dfs(d-1,1,min(2,b*2+1));
        ret += dfs(d-1,a,min(2,b*2));
    }else{
        ret += dfs(d-1,a,min(2,b*2));
        if(a && b) ret += dfs(d-1,a,min(2,b*2-1));
    }
    if(b){
        if(N&(1LL<<d)){
            ret += dfs(d-1,1,min(2,b*2-1));
        }else{
            ret += dfs(d-1,a,min(2,b*2-2));
        }
    }
    ret %= MOD;
    return ret;
}
ll solve(){
    init();
    cin >> N;
    return dfs(60,0,0);
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mset(m,v) memset(m,v,sizeof(m))
#define pr(a,s) printf("Case #%lld: %lld\n",a,s)
#define mod 1000000007
#define mp make_pair
#define all(a)                a.begin(),a.end()
#define pb push_back
#define scan(a) scanf("%d",&a)
#define scanl(a) scanf("%lld",&a)
#define se second
#define fi first
#define pi 3.14159265358979323
#define pii pair<ll,ll>
 
const ll inf = 1e15;
const int MAXM = 1e3+4;
const int MAXN = 1e7+1;

char matrix[MAXM][MAXM];
int n,m;
bool visit[MAXM][MAXM];
ll dp[MAXM][MAXM];
int dx[2] = {1,0};
int dy[2] = {0,1};

bool check(int x, int y)
{
	return x < 1 or y < 1 or x > n or y > m;
}


ll solve(int x, int y)
{
	if (x == n and y == m)	return 1LL;
	if (dp[x][y] != -1)	return dp[x][y];
	ll ret = 0;
	visit[x][y] = true;
	for (int i=0;i<2;i++) {
		int px = x + dx[i];
		int py = y + dy[i];
		if (check(px, py))	continue;
		if (matrix[px][py] == '#')	continue;
		if (visit[px][py])	continue;
		ret += solve(px, py);
		if (ret >= mod)	ret %= mod;
	}
	visit[x][y] = false;
	if (ret >= mod)	ret %= mod;
	return dp[x][y] = ret;
}

int main() 
{
	mset(dp,-1);
	cin>>n>>m;
	for (int i=1;i<=n;i++) {
		for (int j=1;j<=m;j++) {
			visit[i][j] = false;
			cin>>matrix[i][j];
		}
	}
	cout << solve(1,1) << endl;
	return 0;
}

Measured memory_bytes: 10240
#include <iostream>
#include <algorithm>
#include <vector>
#define ll long long
#define __ ios::sync_with_stdio(0), cin.tie(NULL);
#define endl "\n"
using namespace std;

ll x,a,b;

int main(){
	cin >> x >> a >> b;
	cout << (x-a)%b << endl;
}

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

#define LL long long
#define hell 1000000007
#define PI acos(-1.0)
const int sz = 1e6+5;
int dp[sz];



int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << showpoint;
cout << setprecision(11);

int n;cin>>n;

for(int i=0;i<sz;i++) dp[i]=1;

int ar[n];for(int i=0;i<n;i++) cin>>ar[i];

int ans = 0;
sort(ar, ar+n);
int sv[sz];
memset(sv, 0, sizeof(sv));
for(int i=0;i<n;i++)
{
    sv[ar[i]]+=1;
}
for(int i=1;i<sz;i++)
{
    if(sv[i]==0) continue;

    int p = 2*i;
    while(p<sz)
    {
        dp[p]=0;p+=i;
    }
}

for(int i=1;i<sz;i++)
{
   if(sv[i]==1 && dp[i]==1)
   {
     ans+=1;
   }
}
cout<<ans;

return 0;
} 

Measured memory_bytes: 12232
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	char c; 
  cin >> c;
 
  if(c =='a'){
    cout << "vowel" << endl;
  }
  else if(c =='i'){
    cout << "vowel" << endl;
  }
   
  else if(c =='u'){
    cout << "vowel" << endl;
  }
   
  else if(c =='e'){
    cout << "vowel" << endl;
  }
   
  else if(c =='o'){
    cout << "vowel" << endl;
  }
   
 else{
      cout << "consonant" << endl;
  }
 
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(vector<int>& P) {
        int mn = 1 << 24;
        int n = P.size();
        int res = 0;
        for (int i = 0; i < n; ++i) {
            if (P[i] <= mn) {
                ++res;
            }
            mn = min(mn, P[i]);
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> P(n);
    for (int i = 0; i < n; ++i) {
        cin >> P[i];
    }

    Solution sol;
    cout << sol.solve(P) << "\n";

    return 0;
}

Measured memory_bytes: 1024
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
const ll E=1e17+7;
#define F first
#define S second
#define MK make_pair



int main(){
    bool s[100000]={};
    vector<int> S;
    for(int i=2;i<100000;i++){
        if(!s[i]){
            if(i%5==1){S.push_back(i);}
            for(int t=2;i*t<100000;t++){
                s[i*t]=true;
            }
        }
    }
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cout<<S[i];
        if(i!=n-1){cout<<" ";}
    }
    cout<<endl;
    
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

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

int main() {
	string str;
	cin >> str;
	
	cout << (str.size() / 2) - count(str.begin(), str.end(), 'p') << endl;
	return 0;
}

Measured memory_bytes: 512
use proconio::input;

fn main() {
    input! {
        a: char,
        b: char,
    };

    if a == 'H' {
        if b == 'H' {
            println!("H");
        } else {
            println!("D");
        }
    } else {
        if b == 'H' {
            println!("D");
        } else {
            println!("H");
        }
    }
}


Measured memory_bytes: 2144
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

int n,m;//nは頂点数、mは辺の数
vector<pair<int, int> > edge;//edge[i](first, second) i番目の辺はfirst->second
vector<ll> weight;//weight[i] i番目の辺の重み
vector<ll> d(1010,LINF);//各頂点の始点からの最短距離。INFで初期化してある
vector<bool> negative(1010,false);

bool bellmanford(int start){
    d[start] = 0;
    for(int i = 0; i < n-1; i++){
        for(int j = 0; j < m; j++){
            auto p = edge[j];
            if(d[p.second] > d[p.first] + weight[j]){
                d[p.second] = d[p.first] + weight[j];
            }
        }
    }

    return true;
}

bool boolbellmanford(int start){
    d[start] = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            auto p = edge[j];
            if(d[p.first] == LINF) continue;
            if(d[p.second] > d[p.first] + weight[j]){
                d[p.second] = d[p.first] + weight[j];
                negative[p.second] = true;
            }
            if(negative[p.first]) negative[p.second] = true;
        }
    }
    return true;
}
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    edge.resize(m);
    weight.resize(m);
    rep(i,m){
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--; b--;
        edge[i] = make_pair(a,b);
        weight[i] = -c;
    }

    bellmanford(0);
    boolbellmanford(0);

    if(negative[n-1]) cout << "inf" << endl;
    else cout << -d[n-1] << endl;

    return 0;
}

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

using namespace std;

int dp[51][51];

int main()
{
    int h, w;
    string road[51];

    cin >> h >> w;
    for (int i = 0; i < h; i++)
        cin >> road[i];
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            dp[i][j] = (int)road[i][j] - '0';

    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++) {
            if (i > 0 && j > 0)
                dp[i][j] += min(dp[i - 1][j], dp[i][j - 1]);
            else if (i == 0)
                dp[i][j] += dp[i][j - 1];
            else if (j == 0)
                dp[i][j] += dp[i - 1][j];
        }
    cout << dp[h - 1][w - 1] << endl;

    return 0;
}

Measured memory_bytes: 1220
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;

using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<ll, ll> pii;
typedef long double ld;

typedef pair<ld, ld> pld;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

typedef vector<ll> vi;
typedef vector<pii> vpii;
namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> &a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> &a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> &a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;

void solve() {
    int a,  b, c, d;
    cin >> a >> b >> c >> d;
    int e = 0;
    while (a > 0 && c > 0) {
        if (e % 2 == 0) c -= b;
        else a -= d;
        ++e;
    }
    if (a > 0) put("Yes");
    else put("No");
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}


Measured memory_bytes: 3608
# 1<=a,b<=10000
# a,bは整数

#number = input('整数を入力してね > ')
#print (number)
a, b = map(int, input().split())
#print(a, b)
c = a * b
#print(c)
d=c%2
if d==0:
    print('Even')
if d==1:
    print('Odd')

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using ld = long double;
using pll = pair<ll, ll>;

const int N = 100 * 1000 + 10;

ll delta_a[N];
ll delta_b[N];

void add_segm(int init_val, int l, int r) {
    delta_b[l]++;
    delta_a[l] += init_val - 1;
    delta_b[r + 1]--;
    delta_a[r + 1] -= init_val + (r - l); 
}

int main() {
#ifdef LOCAL
    // freopen("input", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(12);

    int n, m;
    cin >> n >> m;
    ll res = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        --a[i];
    }
    for (int i = 0; i < n - 1; i++) 
        res += (a[i + 1] - a[i] + m) % m;
    if (m == 2) {
        cout << res << '\n';
        return 0;
    }
    for (int i = 0; i < n - 1; i++) {
        if (a[i] == a[i + 1])
            continue;
        if ((a[i] + 1) % m == a[i + 1])
            continue;
        int s = (a[i] + 2) % m;
        if (s <= a[i + 1])
            add_segm(1, s, a[i + 1]);
        else {
            add_segm(1, s, m - 1);
            add_segm(m - s % m + 1, 0, a[i + 1]);
        }
    }
    ll cura = 0;
    ll curb = 0;
    ll ans = res;
    for (int i = 0; i < m; i++) {
        curb += delta_b[i];
        cura += delta_a[i] + curb;
        ans = min(ans, res - cura);
    }
    //cerr << endl;
    cout << ans << "\n";
}


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

int a[30];
string s;

int main() {
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		a[(int)s[i] - 97]++;
	}
	bool flag = false;
	for (int i = 0; i < 26; i++) {
		if (a[i] % 2 != 0)flag = true;
	}
	if (flag)cout << "No";
	else cout << "Yes";
	cout << endl;
	return 0;
}

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

int main(){
  ll x;
  cin>>x;
  int y=0;
  for(ll i=100;i<x;i+=(ll)((double)i*0.01)){
    y++;
  }
  cout<<y<<endl;
  return 0;
}



Measured memory_bytes: 3592
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define MOD 998244353
using namespace std;

int main() {
    long long n, a[100005];
    cin >> n;
    for (int i = 0; i < n; i++)cin >> a[i];
    sort(a, a+n, greater<int>());
    int t=a[0];
    vector<long long> l;
    for (int i = 1; i < n; i++) {
        if (t == a[i]) {
            l.push_back(t);
            t = -1;
        }
        else t = a[i];
        if (l.size() == 2) {
            cout << l[0] * l[1] << endl;
            return 0;
        }
    }
    cout << '0' << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
int x=0,m=0,u=0,t=0;
string N;
cin>>N;
int len=N.length();
for(int i=0;i<len;i++){
	if(N[i]=='A'){
	x=i;
	t=1;
}
if(t==1)
break;
}
for(int y=len-1;y>0;y--){
	
	if(N[y]=='Z'){
		
		m=y;
		u=1;
	}
	if(u==1)
	break;
}
cout<<m-x+1;
}


Measured memory_bytes: 640
const main = stdin => {
  const input = stdin.trim().split('\n')
  const [A, B] = input[0].split(' ').map(x => parseInt(x))
  const ans = Math.max(A + B, A - B, A * B)

  if (ans === 0) {
    console.log(0)
  } else {
    console.log(ans)
  }
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29500
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CSequenceGrowingEasy solver = new CSequenceGrowingEasy();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSequenceGrowingEasy {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] ar = new int[n];
            for (int i = 0; i < n; i++) {
                ar[i] = in.nextInt();
            }
            long res = 0;
            for (int i = 0; i < n; i++) {
                if (i == 0) {
                    if (ar[0] != 0) {
                        res = -1;
                        break;
                    }
                } else {
                    if (ar[i] - ar[i - 1] > 1) {
                        res = -1;
                        break;
                    } else {
                        if (ar[i] - ar[i - 1] == 1) {
                            res++;
                        } else {
                            res += ar[i];
                        }
                    }
                }
            }
            out.println(res);
        }

    }
}



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

ll div_2(ll n) {
    ll res = 0;

    while(n > 1) {
        n /= 2;
        res++;
    }
    return res;
}

int main() {
    ll H;
    cin >> H;

    ll t = div_2(H);
    ll ans = pow(2, t + 1) - 1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
x,y,z,K = map(int,input().split())
ans = 0
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ans = []
for i in range(x):
    for j in range(min(K//(i+1),y)):
        for k in range(min(z,K//((i+1)*(j+1)))):
            if (i+1)*(j+1)*(k+1)<=K:
                ans.append(a[i]+b[j]+c[k])
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])

Measured memory_bytes: 8708
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll S;
    cin >> S;

    constexpr ll C = 1e9;
    if (S <= C) {
        cout << "0 0 1 0 0 " << S << endl;
    } else if (S == C * C) {
        cout << "0 0 " << C << " " << 0 << " " << 0 << " " << C << endl;
    } else {
        ll up = S / C;
        ll down = S % C;

        ll x1 = 0;
        ll x2 = S % C;
        ll x3 = C;
        ll y1 = S / C;
        ll y2 = 0;
        ll y3 = y1 + 1;

        cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		long x = scan.nextLong();
		long k = scan.nextLong();
		long d = scan.nextLong();
		x = Math.abs(x);

			if(x/d > k){
				System.out.print(x-d*k);
				return;
			}else{
				k -= x/d;
				x -= d*(x/d);
				if(k%2 == 0){
					System.out.print(x);
				}else{
					System.out.print(Math.min(Math.abs(x+d),(Math.abs(x-d))));
				}

		}
	}
}


Measured memory_bytes: 35672
#include <bits/stdc++.h>
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
 
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(){

    string s;
    cin>>s;

    lli maxLength=0;
    lli prev=-1;
    REP(i,0,s.size()){
        if(s[i]=='A'||s[i]=='G'||s[i]=='C'||s[i]=='T'){
            chmax(maxLength,i-prev);
        }
        else{
            prev=i;
        }
    }

    cout<<maxLength<<endl;


 
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    FAST();
    ll n,i,j,k,a=0,b=0;
    vector<ll>v;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>k;
        v.push_back(k);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    for(i=0;i<n;i+=2)
    {
       a+=v[i];
    }
    for(i=1;i<n;i+=2)
    {
       b+=v[i];
    }
    cout<<a-b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,m,sum=0;
  cin>>n>>m;
  int ar[m];
  for(int i=0;i<m;i++){
    cin>>ar[i];
  }
  for(int i=0;i<m;i++){
    sum=sum+ar[i];
  }
  if(sum>n)
  {
    cout<<-1;
  }
  else{
    cout<<(n-sum);
  }
      
}

Measured memory_bytes: 3648
N, M = map(int, input().split())
mod = 10**9 + 7

ans = M
for i in range(M-1, M-N, -1):
    ans = ans*i % mod


# print(ans)
prev = 1
ansB = M-1


for i in range(1, N):
    tmp = (prev)*i % mod
    tmp2 = ansB - tmp % mod
    # print(tmp2)
    ansB = tmp * (M-i) % mod
    ansB += (tmp2)*(M-i-1) % mod
    # print(tmp, tmp2)
    # ansB = tmp + tmp2
    ansB %= mod
    prev = tmp2
    # print(ansB)

# print(ansB)

print((ans*ansB) % mod)


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pp;
double PI=acos(-1);
int const N = 5e5 + 10,M=2e7+1, oo = 1e9;
const int mod = oo+7;
const ll  OO = 3e18;

int n,m;
string s,t;
map<ll ,int > mp;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    cin>>s>>t;
    ll lcm=n*1LL*m/__gcd(n,m);
    for(int i=0;i<n;i++){
        mp[i*(lcm/n)]=s[i]-'a';
    }
    for(int i=0;i<m;i++){
        if(mp.count(i*(lcm/m))){
            if(t[i]-'a'!=mp[i*(lcm/m)]){
                cout<<-1;
                return 0;
            }
        }
    }
    cout<<lcm;
    return 0;
}



Measured memory_bytes: 6144
#include <stdio.h>

  int main(void){ 
  int a, b, c;
 scanf("%d%d%d", &a, &b, &c);
int ispoor = 0;  
  if (a == b && b != c) ispoor = 1; 
  if (b == c && c != a) ispoor = 1;
  if (c == a && a != b) ispoor = 1;
if (ispoor) { 
  puts("Yes"); 
} else { 
  puts("No"); 
}
 return 0; 
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;

  if (S == U) {
    --A;
  } else {
    --B;
  }
  cout << A << " " << B << endl;

  return 0;
}


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

#define MAX_LETTERS 1000

int ctoi(char d){
  return (d-'0');
}

int main(void) {
  char digits[MAX_LETTERS + 1]="\0";
  int sum = 0, i = 0;
  while (strcmp(digits, "0")){
    scanf("%s",digits);
    if(!strcmp(digits, "0")) break;
    sum = 0;
    for ( i = 0 ; digits[i] != '\0' ; i++ ){
      sum += ctoi( digits[i] );	
    }
    printf("%d\n",sum);
  }
  return 0;
}



Measured memory_bytes: 2036
import java.math.BigDecimal;
import java.util.Scanner;
        
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        BigDecimal a = new BigDecimal(sc.next());
        BigDecimal b = new BigDecimal(sc.next());
        BigDecimal answer;

        answer = a.multiply(b);
        String answerStr = answer.toString();
        int ten = answerStr.lastIndexOf(".");
        
        if (ten == -1) {
            System.out.println(answerStr);
        } else {
            System.out.println(answerStr.substring(0, ten));
        }
    }
}

Measured memory_bytes: 36020
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;
typedef char CHAR;
typedef unsigned char UCHAR;
typedef short SHORT;
typedef unsigned short USHORT;
typedef int INT;
typedef unsigned int UINT;
typedef long long LLONG;
typedef unsigned long long ULLONG;

#define LengthOf(x)    (sizeof(x) / sizeof(x[0]))



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

	int work = 0;
	for (int i = 0; i < M; ++i) {
		int tmp = 0;
		cin >> tmp;
		work += tmp;
	}

	if (work > N) { cout << "-1"; }
	else {
		cout << N - work;
	}

	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for(auto v:(V))cout<<v<<" "<<endl
inline int GCD(int a, int b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;

int main()
{
    vll A(5);
    ll N;
    cin >> N;
    rep(i, 5)
    {
        cin >> A[i];
    }
    decltype(A)::iterator i = std::min_element(ALL(A));
    if (N % (*i) == 0)
    {
        cout << N/(*i)+4 << endl;
    }
    else
    {
        cout << N / (*i) + 5 << endl;
    }
}

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

int main(){
   int p1,p2,p3,j1,j2,set;
   cin>>p1>>p2>>p3>>j1>>j2;
   if(p1<p2&&p1<p3){
     if(j1<j2){
       set = p1+j1-50;
       cout<<set<<endl;
     }else{
       set = p1+j2-50;
       cout<<set<<endl;
     }
   }else if(p2<p1&&p2<p3){
     if(j1<j2){
       set = p2+j1-50;
       cout<<set<<endl;
     }else{
       set = p2+j2-50;
       cout<<set<<endl;
     }
   }else if(p3<p1&&p3<p2){
     if(j1<j2){
       set = p3+j1-50;
       cout<<set<<endl;
     }else{
       set = p3+j2-50;
       cout<<set<<endl;
     }
   }else if(p1==p2||p1==p3){
     if(j1<j2){
       set = p1+j1-50;
       cout<<set<<endl;
     }else{
       set = p1+j2-50;
       cout<<set<<endl;
     }
   }else if(p1==p2||p2==p3){
     if(j1<j2){
       set = p2+j1-50;
       cout<<set<<endl;
     }else{
       set = p2+j2-50;
       cout<<set<<endl;
     }
   }
   return 0;
}


Measured memory_bytes: 3088
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    for (int N; cin >> N;) {
        int t = N;
        int ans = 0;
        while (t) {
            if (t % 10 == 0)
                t /= 10;
            else if (t == 1) {
                ans += 9;
                break;
            } else
                break;
        }
        while (N) {
            ans += N % 10;
            N /= 10;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define P 1000000007

long long *dp[2], t = 0;
int forbidden(int c){return c%125==7||c%125==11||c%125==51||(c%25==11&&!(c/125))||(c%5==1&&c/25==2);}
long long *alloc() {
	int i;
	long long *p = (long long*)malloc(625*sizeof(long long));
	for(i = 0; i < 625; i++)
		p[i] = 0;
	return p;
}
int main() {
	int n, nx, i, j;
	scanf("%d", &n);
	for(i = 0; i < 2; i++)
		dp[i] = alloc();
	dp[0][624] = 1;
	while(n--) {
		for(i = 0; i < 625; i++)
			for(j = 0; j < 4; j++) {
				nx = (i % 125) * 5 + j;
				if(!forbidden(nx))
					dp[1][nx] = (dp[1][nx] + dp[0][i]) % P;
			}
		free(dp[0]);
		dp[0] = dp[1];
		dp[1] = alloc();
	}
	for(i = 0; i < 625; i++)
		t = (t + dp[0][i]) % P;
	printf("%d", t);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; cin>>n;
	int a[101];
	fill(a, a+n, 1e6);
	for(int i=0; i<n-1; i++){
		int b; cin>>b;
		a[i]=min(a[i], b);
		a[i+1]=min(a[i+1], b);
	}
	int ans=0;
	for(int i=0; i<n; i++) ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e6 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int a,b;
   cin >> a >> b;
   f(i,1,N){
      int ff = (i*0.08),ss = i*0.1;
      if(ff == a and ss == b){
         cout << i << '\n';
         return 0;
      }
   }
   int ff = a/0.08,ss = b/0.1;
   if(ff == ss){
      cout << ff << '\n';
      return 0;
   }
   cout << "-1\n";
   return 0;
}

Measured memory_bytes: 256
u[9];
  
D(s,v)
{
    int i, res;
  
    if (!s)return!v;
    if (v<0||v>s*-~s*5)return 0;
    res = 0;
    for(i=0;i<=9;++i){
        if (!u[i]){
            u[i]=1;
            res+=D(s-1,v-i*s);
            u[i]=0;
        }
    }
    return (res);
}
  
main(n,v)
{
    while (~scanf("%d %d",&n,&v))printf("%d\n", D(n,v));
    return (0);
}

Measured memory_bytes: 600
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define reps(i, s, n) for (int i = s; i < (int)(n); ++i)
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1LL << 60;

void solve() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll v = c - a - b;
    if (v > 0 and 4 * a * b < v * v)
        cout << "Yes\n";
    else
        cout << "No\n";
}
int main() {
    cin.tie(nullptr);
    // ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    solve();
}

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

int main(){
    string s;
    cin >> s;
    int l;
    l=s.size();
    int k=0;
    rep(i,l-1){
        if(s[i]==s[i+1]){
            k=1;
        }
    }

    if(k==1){
        cout << "Bad" << endl;
    }
    else{
         cout << "Good" << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"2018 218"# => "Yes",
// r#"2763 0"# => "No",
r#"7 3"# => "1",

}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
        k: usize,
    }
    (if n % k == 0 { 0 } else { 1 }).to_string()
}

Measured memory_bytes: 4352