akhauriyash/Code-Regression huggingface dataset:
// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

int Q;
int l[100001], r[100001];
bool prime[100001];
bool prime2017[100001];
int n_prime2017[100001];
void sieve(ll n)
{
    REP(i, n+1) prime[i] = true;
    prime[0] = prime[1] = false;
    FOR(i, 2, n+1){
        if(prime[i]){
            for(ll j = 2*i; j <= n; j += i){
                prime[j] = false;
            }
        }
    }
}

void init()
{
}

void solve()
{
    sieve(100000);
    FOR(i, 3, 100001){
        if(prime[i] && prime[(i+1)/2]) prime2017[i] = true;
    }
    REP(i, 100001){
        n_prime2017[i+1] = n_prime2017[i];
        if(prime2017[i+1]) n_prime2017[i+1]++;
    }
    REP(i, Q){
        cout << n_prime2017[r[i]] - n_prime2017[l[i]-1] << endl;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> Q;
    REP(i, Q){
        cin >> l[i] >> r[i];
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


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

int main() {
  long long N,K = 0;
  cin >> N >> K;
  vector<long long> H(N);
  long long sum = 0;
  
  if(K >= N){
    sum = 0;
  }
  else{
    for(int i = 0;i < N;i++){
      cin >> H[i];
    }
    sort(H.begin(),H.end());
    reverse(H.begin(),H.end());
  
    for(int i = 0;i < K;i++){
      H[i] = 0;
    }


    for(int i = 0;i < N;i++){
      sum = sum + H[i];
    }
}
  cout << sum << endl;
}


Measured memory_bytes: 1792
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
L = [LIST() for i in range(N)]

for i in range(N - 3 + 1):
    # print(L[i][0], L[i][1], L[i+1][0], L[i+1][1], L[i+2][0], L[i+2][1])
    
    if L[i][0] == L[i][1] and L[i+1][0] == L[i+1][1] and L[i+2][0] == L[i+2][1]:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 10636
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int H=0,W=0,i,j;
        while(true){
        	H=scan.nextInt();
        	W=scan.nextInt();
        	if(H==0 && W==0)break;
        	for(i=0;i<H;i++){
        		for(j=0;j<W;j++){
        			if((i+j)%2==0){
        				System.out.print("#");
        			}
        			else{
        				System.out.print(".");
        			}
        		}
        		System.out.println("");
        	}
        	System.out.println("");
        }
    }
}

Measured memory_bytes: 32792
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<limits>
#include<queue>
#include<stack>
#include<math.h>
#include<array>
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;
int main(){
	int N; string S;
	cin >> N >> S;
	int ans = 0;
	for(int i = 0; i < N; i++){
		int cnt = 0;
		for(char c ='a'; c <= 'z'; c++){
			bool left = false, right = false;
			for(int j = 0; j < i; j++){
				if(S[j] == c) left = true;
			}
			for(int j = i; j < N; j++){
				if(S[j] == c) right = true;
			}
			if(right && left) cnt++;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s=input()
cnt_10=0
cnt_01=0

for i in range(len(s)):
  if i%2==0:
    if s[i]=='1':
      cnt_10+=1
    else:
      cnt_01+=1
  else:
    if s[i]=='1':
      cnt_01+=1
    else:
      cnt_10+=1
print(min(cnt_01, cnt_10))

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

string S[100010];
int main()
{
	int N;
	cin >> N;
	cout << 0 << endl;
	cin >> S[0];
	int ng = 0;
	int ok = N;
	while (abs(ng - ok) > 1) {
		int mid = (ng + ok) / 2;
		cout << mid << endl;
		cin >> S[mid];
		if (S[mid] == "Vacant") return 0;
		if ((ng + mid) % 2 == 0) {
			if (S[ng] == S[mid]) ng = mid;
			else ok = mid;	
		}
		else {
			if (S[ng] == S[mid]) ok = mid;
			else ng = mid;
		}
	}
}

Measured memory_bytes: 6680
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007;
const lint LINF = 1111111111111111111; 

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	lint A, B, Q;
	cin >> A >> B >> Q;

	vector<lint> s(A), t(B), x(Q);
	for (int i = 0; i < A; i++) cin >> s[i];
	for (int i = 0; i < B; i++) cin >> t[i];
	for (int i = 0; i < Q; i++) cin >> x[i];

	lint ups, los, upt, lot;

	for (const auto &elem : x) {
		vector<lint> cost(8, LINF);
		ups = -1, los = -1, upt = -1, lot = -1;

		if (lower_bound(s.begin(), s.end(), elem) <  s.end() ) ups = *lower_bound(s.begin(), s.end(), elem);
		if (lower_bound(s.begin(), s.end(), elem) > s.begin()) los = *(lower_bound(s.begin(), s.end(), elem) - 1);
		if (lower_bound(t.begin(), t.end(), elem) <  t.end() ) upt = *lower_bound(t.begin(), t.end(), elem);
		if (lower_bound(t.begin(), t.end(), elem) > t.begin()) lot = *(lower_bound(t.begin(), t.end(), elem) - 1);

		if (lower_bound(t.begin(), t.end(), ups) > t.begin() && ups != -1) cost[0] = abs(ups - elem) + abs(*(lower_bound(t.begin(), t.end(), ups) - 1) - ups);
		if (lower_bound(t.begin(), t.end(), ups) <  t.end()  && ups != -1) cost[1] = abs(ups - elem) + abs(*lower_bound(t.begin(), t.end(), ups) - ups);
		if (lower_bound(t.begin(), t.end(), los) > t.begin() && los != -1) cost[2] = abs(los - elem) + abs(*(lower_bound(t.begin(), t.end(), los) - 1) - los);
		if (lower_bound(t.begin(), t.end(), los) <  t.end()  && los != -1) cost[3] = abs(los - elem) + abs(*lower_bound(t.begin(), t.end(), los) - los);
		if (lower_bound(s.begin(), s.end(), upt) > s.begin() && upt != -1) cost[4] = abs(upt - elem) + abs(*(lower_bound(s.begin(), s.end(), upt) - 1) - upt);
		if (lower_bound(s.begin(), s.end(), upt) <  s.end()  && upt != -1) cost[5] = abs(upt - elem) + abs(*lower_bound(s.begin(), s.end(), upt) - upt);
		if (lower_bound(s.begin(), s.end(), lot) > s.begin() && lot != -1) cost[6] = abs(lot - elem) + abs(*(lower_bound(s.begin(), s.end(), lot) - 1) - lot);
		if (lower_bound(s.begin(), s.end(), lot) <  s.end()  && lot != -1) cost[7] = abs(lot - elem) + abs(*lower_bound(s.begin(), s.end(), lot) - lot);

		cout << *min_element(cost.begin(), cost.end()) << "\n";

	}

	return 0;
}

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

int main(){
  int n,k;
  cin >> n >> k;
  int order[n+1]={0};
  for(int i=1;i<=n;i++){
    int t=i;
    while(t<k){
      t*=2;
      order[i]++;
    }
  }
  double ans=0;
  for(int i=1;i<=n;i++){
    ans+=pow(0.5,order[i]);
  }
  ans/=n;
  cout << fixed << setprecision(10) << ans << endl;
}

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

int h,A1[500001];

int left(int i){ return i*2;}
int right(int i) { return i*2+1;}

void maxHeapify(int i){
    int largest;
    int l = left(i);
    int r = right(i);
    if(l<=h && A1[l]>A1[i])
        largest = l;
    else
        largest = i;
    if(r<=h && A1[r]>A1[largest])
        largest = r;
    
    if(largest!=i){
        /*int tmp = A1[i];
        A1[i] = A1[largest];
        A1[largest] = tmp;
        maxHeapify(largest);*/
        swap(A1[i],A1[largest]);
        maxHeapify(largest);
    }
}

int main(){
    cin >> h;
    
    for(int i=1; i<=h; i++){
        cin >> A1[i];
    }
    for(int i=h/2; i>=1; i--){
        maxHeapify(i);
    }
    
    for(int i=1; i<=h; i++){
        cout << " " << A1[i];
    }
    cout << endl;
}

Measured memory_bytes: 4944
#include<stdio.h>
int main(void) {
    int N, i, n, k;
    n = 1;
    scanf("%d %d", &N, &k);
    for ( i = 0; i < N; i++ ) {
        if ( n * 2 >= n + k) n = n + k;
        else n = 2 * n;
    }
    printf("%d\n", n);
   return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
int main(){
  ll N; cin>>N;
  vector<ll> v;
  rep(i,N){
    ll a; cin>>a;
    v.push_back(a);
  }
  
  bool ok=true;
  rep(i,N-1){
    if(v[i]!=v[i+1]) ok=false;
    else continue;
  }
  
  if(!ok){
  
  vector<ll> odd;
  vector<ll> even;
    vector<ll> oddo;
  vector<ll> eveno;
  rep(i,100000){
    odd.push_back(0);
    even.push_back(0);
    oddo.push_back(0);
    eveno.push_back(0);
  }
  
  rep(i,N){
    ll d=v[i]-1;
    if(i%2==0) {
      odd[d]++; oddo[d]++;
    }
    else {
      even[d]++; eveno[d]++;
    }
  }
  
  sort(odd.begin(),odd.end());
  reverse(odd.begin(),odd.end());
  sort(even.begin(),even.end());
  reverse(even.begin(),even.end());
  ll key=N/2;
  ll odd1=odd[0];
  ll even1=even[0];
  ll odd2=odd[1];
  ll even2=even[1];
  bool ok1=true;
   
  ll judge1;
  ll judge2;
  rep(i,100000){
    if(oddo[i]==odd1) {
      judge1=i; break;
    }
    else continue;
  }
  rep(i,100000){
    if(eveno[i]==even1) {
      judge2=i; break;
    }
    else continue;
  }
  
  if(judge1==judge2){
    ok1=false;
    if(even2>odd2) {
      ll ans=key-odd1+key-even2;
      cout<<ans<<endl;
    }
    else{
      ll ans=key-odd2+key-even1;
      cout<<ans<<endl;
    }
  }
  
  if(ok1){
  ll ans=key-odd1+key-even1;
  cout<<ans<<endl;
  }
  }
  
  if(ok) cout<<N/2<<endl;
}



Measured memory_bytes: 5620
#include<stdio.h>
#include<stdlib.h>
#define  ll long long
#define MOD 1000000007


ll modpow(ll a,ll n)
{
	ll res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % MOD;
		a = a * a % MOD;
		n /= 2;
	}
	return res;
}

#if 0
ll rui( ll a,ll b){
  if(a==1)return 1;
  else {ll c=1;
   for(;b!=0;b--){
     c=c*a%MOD;
   };     
   return c%MOD; 
  };
};  
#endif
int main(){
  ll n,k,d, ans=0;
  scanf("%lld %lld",&n,&k);
  ll  w[k+1];
  for(int a=k;a!=0;a--){
    d=k/a;
    //printf("%lld\n",d);
    w[a]=modpow(d,n);
    for(ll j=2;j*a<=k;j++){
      w[a]-=w[a*j];
    }; 
    if(w[a]>MOD)w[a]%=MOD;
    //printf("%lld ",w[a]);
    ans+=(w[a]*a)%MOD;
  };
  ans%=MOD;
  printf("%lld",ans);
};

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	rep(i,(1<<3)){
		int num = (s[0] - '0');
		rep(j,3){
			if(i>>j & 1){
				num += (s[j+1] - '0');
			}
			else{
				num -= (s[j+1] - '0');
			}
		}
		if(num == 7){
			cout << s[0] << ((i>>0 & 1) ? "+" : "-");
			cout << s[1] << ((i>>1 & 1) ? "+" : "-");
			cout << s[2] << ((i>>2 & 1) ? "+" : "-");
			cout << s[3] << "=7" << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll h,w;cin>>h>>w;
  vector<lvector> G(h),dp(h+1,lvector(w+1,1e9));
  string s;
  rep(i,h) {cin>>s;rep(j,w) G[i].emplace_back(s[j]=='#');}
  dp[0][0]=G[0][0];
  for(ll i=0;i<h;++i) {
    for(ll j=0;j<w;++j) {
      if(i-1>-1) dp[i][j]=dp[i-1][j]+(G[i][j]&&!G[i-1][j]);
      if(j-1>-1) dp[i][j]=min(dp[i][j],dp[i][j-1]+(G[i][j]&&!G[i][j-1]));
    }
  }
  print(dp[h-1][w-1]);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n; cin >> n;
    set<string> st;
    rep(i, n) {
        string x; cin >> x;
        st.insert(x);
    }

    cout << st.size() << endl;
}

Measured memory_bytes: 19232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 987654321;
const ll MOD = 1000000007;
//const long double PI = (acos(-1));
//const long double EPS = 0.0000000001;
int dy[2] = {0, 0};
int dx[2] = {-1, 1};

int h, w, k;
vector<string> brd;
vector<vi> ret;

int main(void) {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); 
	cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	cin >> h >> w >> k;
	brd.resize(h);
	rep(i,0,h) {
		cin >> brd[i];
	}
	ret = vector<vi>(h, vi(w, -1));

	int cnt = 1;
	queue<pii> Q;
	rep(i,0,h) rep(j,0,w) {
		if(brd[i][j] == '#') {
			ret[i][j] = cnt++;
			Q.push(mp(i,j));
		}
	}
	
	while(!Q.empty()) {
		int y = Q.front().F;
		int x = Q.front().S;
		Q.pop();
		rep(i,0,2) {
			int ny = y + dy[i];
			int nx = x + dx[i];
			if(ret[ny][nx] == -1) {
				ret[ny][nx] = ret[y][x];
				Q.push(mp(ny,nx));
			}
		}
	}

	rep(i,1,h) {
		rep(j,0,w) {
			if(ret[i][j] != -1) {
				break;
			}
			ret[i][j] = ret[i-1][j];
		}
	}

	per(i,0,h-1) {
		rep(j,0,w) {
			if(ret[i][j] != -1) {
				break;
			}
			ret[i][j] = ret[i+1][j];
		}
	}

	rep(i,0,h) {
		rep(j,0,w) {
			cout << ret[i][j] << ' ';
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <map>
using namespace std;

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

    long long A[N], B[N], C[N];

    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<N;i++){
        cin >> B[i];
    }
    for(int i=0;i<N;i++){
        cin >> C[i];
    }
    sort(A, A + N);
    sort(C, C + N);

    long long res = 0;
    for(int b=0;b<N;b++){
        long long a = lower_bound(A, A + N, B[b]) - A;
        long long c = N-(upper_bound(C, C + N, B[b]) - C);
        res += a*c;
    }
    cout << res << endl;
}

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

int main() {

    int a, b, c, x; cin >> a >> b >> c >> x;
    int ans = 0;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if (500 * i + 100 * j + 50 * k == x) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, w = map(int, input().split())
data = []
v_sum = 0
inf = 10**12
for i in range(n):
    data.append(list(map(int, input().split())))
    v_sum += data[i][1]

dp = [[inf for i in range(v_sum+1)] for j in range(n+1)]
dp[0][0] = 0
for i in range(1,n+1):
    weight, v = data[i-1]
    for j in range(v_sum+1):
        if j - v >= 0:
            dp[i][j] = min(dp[i-1][j], dp[i-1][j-v] + weight)
        else:
            dp[i][j] = dp[i-1][j]
ans = 0
for i in range(v_sum+1):
    if dp[-1][i] <= w:
        ans = max(ans, i)
print(ans)

Measured memory_bytes: 171248
#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() {
    cin.tie(0);
   	ios::sync_with_stdio(false);

    int i, j, k, l, n, x;
    int cnt, ans;
    vector<vector<int>> nums;

    cnt = 0;
    while (1) {
        cin>>n>>x;
        if (n == 0 && x == 0) break;

        vector<int> nx(2);
        nx[0] = n; nx[1] = x;
        nums.push_back(nx);
        cnt++;
    }

    rep(i, cnt) {
        ans = 0;
        n = nums[i][0]; x = nums[i][1];
        rep(j, n) {
            rep(k, n) {
                rep(l, n) {
                    if (j + k + l + 3 == x && j != k && k != l && l != j) ans++;
                }
            }
        }
        cout<<ans/6<<endl;
    }
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

int main(){
  map<char,int> m;
  rep(i,4){
    char tmp; cin>>tmp;
    if(m.count(tmp))m[tmp]++;
    else m[tmp] = 1;
  }
  int flag = 0;
  for(auto p:m){
    if(p.second==2)flag++;
  }
  if(flag == 2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
N = int(input())

ans = 0
for n in range(1, N+1):
    if n % 2 == 0:
        continue
    elif n < 105:
        continue
    count = 0
    for j in range(1, n+1):
        if n % j == 0:
            count += 1
            if count >= 9:
                break
    if count == 8:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n, m ;
    cin >> n >> m;
    vector<int> l(m), r(m);
    rep(i, m) cin >> l[i] >> r[i];

    int lmax = *max_element(all(l));
    int rmin = *min_element(all(r));
    put(max(0, rmin - lmax + 1));

    

    return 0;
}

Measured memory_bytes: 3976
N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]


vc = []
for i in range(N):
  if V[i] - C[i] >0:
    vc.append( V[i] - C[i])
  
  
print(sum(vc))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
 
using namespace std;
 
void calcLucasSequence(vector<long>& lucasSequence, const int numOfTerm);
 
int main() {
    int numOfTerm = 0;
    cin >> numOfTerm;
    
    vector<long> lucasSequence;
    calcLucasSequence(lucasSequence, numOfTerm);
    
    cout << lucasSequence.at(numOfTerm) << endl;  
}
 
void calcLucasSequence(vector<long>& lucasSequence, const int numOfTerm) {
    const long INITIAL_TERM = 2;
    const long SECOND_TERM = 1;
    
    lucasSequence.push_back(INITIAL_TERM);
    lucasSequence.push_back(SECOND_TERM);
    for (int term_i = 2; term_i <= numOfTerm; ++term_i) {
        lucasSequence.push_back(lucasSequence.at(term_i - 1) + lucasSequence.at(term_i - 2));
    }
} 

Measured memory_bytes: 3640
def sh(num):
    for n in num:
        out(n)
def out(n):
    number = []
        # print(n[0])
        # print(n[1])
    for i in range(n[1]):
        number.append("#")
    for i in range(1,n[0]+1):
        if i in range(2,n[0]):
            print('#' + '.' * (n[1]-2) + '#')
        else:
            print(''.join(number))
    print('')

num = []
while True:
    n = list(map(int, input().split()))
    if n[0] == 0 and n[1] == 0:
        break
    else:
        num.append(n)
sh(num)

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

using namespace std;

int main(void) {
	string S[60];
	string ans = "";
	int N;

	cin >> N;

	int i;
	for (i = 0; i < N; i++) cin >> S[i];

	int small;
	for (char c = 'a'; c <= 'z'; c++) {
		small = 99;
		for (i = 0; i < N; i++) {
			int cnt = 0;
			for (int j = 0; j < S[i].length(); j++) {
				if (S[i][j] == c) {
					cnt++;
				}
			}
			small = min(small, cnt);
		}

		for (int t = 0; t < small; t++)		ans += c;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int k[100005],n,mon;
int main(){
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>k[i];
		mon+=abs(k[i-1]-k[i]);
	}
    mon+=abs(k[n-1]-k[n]);
	for(int i=0;i<n;++i){
		cout<<mon-(abs(k[i]-k[i-1])+abs(k[i]-k[i+1]))+abs(k[i-1]-k[i+1])<<endl;
	}
}

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

int main(){
    int n,x;
    cin>>n>>x;

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

    sort(a.begin(),a.end());

    int happy=0;

    while(x>=a[happy] && happy<n-1){
        x-=a[happy];
        happy++;
    }

    if(happy==n-1){
        if(x==a[happy]){
            happy++;
        }
    }

    cout<<happy<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int n, x;
    int i, j, k, ans;
    
    while (1) {
        ans = 0;
        scanf("%d %d",&n, &x);
        if(n == 0 && x == 0){
            break;
        }
        for (i = 1; i <= n; i++) {
            for (j = i + 1; j <= n; j++) {
                for (k = j + 1; k <= n; k++) {
                    if (i + j + k == x) ans++;
                }
            }
        }
        
        printf("%d\n", ans);
    }
    return 0;
}




Measured memory_bytes: 2036
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    sa = sum(a)
    t = 0
    mt = 10 ** 10
    for i in range(n-1):
        t += a[i]
        sa -= a[i]
        mt = min(mt, abs(t - sa))
    print(mt)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 75888
import java.util.*;

public class Main {
    //-------------------------------------------------------------//
    public static final void main(String[] args) {
        new Main().solve();
    }
    //-------------------------------------------------------------//
    private final Scanner sc = new Scanner(System.in);
    void solve() {
        long[] cs = new long[3];
        for (int i = 0; i < 3; i++) cs[i] = sc.nextInt();
        long ans = 0;
        long s = System.currentTimeMillis();
        do {
            boolean check = false;
            for (int i = 0; i < 3; i++) if (cs[i] % 2 == 1) check = true;
            if (check) break;
            long newA = cs[1] / 2L + cs[2] / 2L;
            long newB = cs[0] / 2L + cs[2] / 2L;
            long newC = cs[0] / 2L + cs[1] / 2L;
            cs[0] = newA; cs[1] = newB; cs[2] = newC;
            ans++;
            if (System.currentTimeMillis() - s >= 1900L) {
                System.out.println(-1);
                return;
            }
        } while(true);
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rep(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define forn(i,n,m) for(int (i)=(n);i<=(int)(m);(i)++)
#define pb push_back
#define mp make_pair
#define re return
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF=1e9;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef queue <int> qi;
int n;
int a[110];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++){
		if(a[i]%2==0)
			if(a[i]%3!=0&&a[i]%5!=0){
				cout<<"DENIED"<<endl;
				return 0;
		}
	}
	cout<<"APPROVED"<<endl;
	return 0;
}

Measured memory_bytes: 256
a,b,c;float d,e;main(){while(scanf("%d%d",&a,&b),a){e=fabs(a-b);for(c=1;c<=a;++c){d=fabs(sqrt(c*c+(a-c)*(a-c))-b);if(e>d)e=d;}printf("%f\n",e);}return 0;}

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

int main(int argc, char* argv[])
{
  int distance = 0;
  int number = 0;
  double x = 0.0;
  double y = 0.0;
  int count = 0;
  cin >> number >> distance;
  for(int i = 0; i < number; i++)
  {
    cin >> x >> y;
    if(distance >= sqrt(pow(x, 2.0)+pow(y, 2.0)))
    {
      count++;
    }
  }
  cout << count << endl;
 }


Measured memory_bytes: 3776
#include<stdio.h>
int A(int);
int main(){
  int a,b[10000],i,j,s=0;
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<a;i++){
    s+=A(b[i]);
  }
  printf("%d\n",s);
  return 0;
}
int A(int n){
  int i;
  if(n<2){
    return 1;
  }
  else if(n==2){
    return 1;
  }
  if(n%2==0){
    return 0;
  }
  for(i=3;i<=n/i;i+=2){
    if(n%i==0)
      return 0;
  }
  return 1;
}

Measured memory_bytes: 632
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<double,int>;
const ll M = 1e9+7;
void add(ll& x, ll y) {x+=y; x%=M;}
void chmax(ll& x, ll y) {if (x<y) x=y;}
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}

int main() {
  ll n; cin>>n;
  ll a=0,b=0,c=0;
  for(a=1;a<=3500;a++) {
    for(b=1;b<=3500;b++) {
      ll up = n*a*b;
      ll dw = 4*a*b-n*(a+b);
      if (dw == 0 || up % dw || up / dw <= 0) continue;
      else {
        ll c = up / dw;
        cout<<a<<" "<<b<<" "<<c<<endl;
        return 0;
      }
    }
  }
}

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

using namespace std;

int main(){
    int n; cin >> n;
    vector<pair<int, int>> ranges(n);
    for(int i=0; i<n; ++i){
        int a, b; cin >> a >> b;
        ranges[i]={b, b-a};
    }
    sort(ranges.begin(), ranges.end());
    bool ans=true;
    int t=0;
    for(int i=0; i<n; ++i){
        if(t>ranges[i].second || ranges[i].second<0){
            ans=false;
            break;
        }
        t+=ranges[i].first-ranges[i].second;
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}



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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    vector<long long> acc(n + 1);
    for (int i = 0; i < n; i++) acc[i + 1] = acc[i] + a[i];
    long long ans = 0;
    map<long long, int> cnt;
    for (auto &s: acc) ans += cnt[s]++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15104
#include <iostream>

int main()
{
 int A, B;
  std::cin >> A >> B;
  if (A % 2 == 1 && B % 2 == 1) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) { 
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return; 
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    //ll N; cin >> N;
    ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    UnionFind tree(N);
    for(int i=0;i<M;i++){
        int x,y,z;
        cin >> x >> y >> z;
        tree.unite(x-1,y-1);
    }
    ll sum=1;
    for(int i=0;i<N;i++){
        if(!tree.same(0,i)){
            tree.unite(0,i);
            sum++;
        }
    }
    
    


    cout << sum << endl;
}

/*



 */



Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0LL;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define IT ::iterator
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);

int main()
{
   ll k,n,i;
   cin >> k >> n;
   ll a[n],b[n],c[n];
   rep(i,n)
   {
   	cin >> a[i];
   }
   rep(i,n)
   {
   	if(i==0)b[i]=k-(k-a[n-1]+a[0]);
   	else b[i]=k-(a[i]-a[i-1]);
   }
   
   sort(b,b+n);
   
   cout << b[0];
}


Measured memory_bytes: 6720
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	int A, B, C, D, E, F, ans_1, ans_2;
	while (~scanf("%d%d%d%d%d%d", &A, &B, &C, &D, &E, &F)) {
		double MaX;
		for (int tA = 0; A * tA * 100 <= F; tA++) 
			for (int tB = 0; B * tB * 100 + A * tA * 100 <= F; tB++) {
				if (tA == 0 && tB == 0) continue;
				int V = A * tA * 100 + B * tB * 100;
				int topX = min((E * V) / 100, F - V);
				int x = 0, numC = 0;
				//printf("%d %d\n", V, topX);
				for (int tC = 0; C * tC <= topX; tC++) {
					if (C * tC + (topX - C * tC) / D * D > x) {
						x = C * tC + (topX - C * tC) / D * D;
						numC = tC;
					}
				}
				if ((100.0 * x) / (V + x) > MaX) {
					MaX = (100.0 * x) / (V + x * 1.0);
					ans_1 = A * tA * 100 + B * tB * 100 + C * numC + (topX - C * numC) / D * D;
					ans_2 = C * numC + (topX - C * numC) / D * D;
				}
			}
		printf("%d %d\n", ans_1, ans_2);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll a, b; cin >> a >> b;
    cout << ((a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) ? "Possible" : "Impossible") << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var N int
	fmt.Scan(&N)
	reader := bufio.NewReader(os.Stdin)
	hString, _ := reader.ReadString('\n')
	hs := make([]int, N)
	for i, v := range strings.Split(hString, " ") {
		var j int
		fmt.Sscan(v, &j)
		hs[i] = j
	}

	count := 0
	highest := 0
	for _, h := range hs {
		if h >= highest {
			highest = h
			count++
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
const int MOD=1e9+7;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int r=0,l=0;
    rep(i,n) {
        if (s[i]=='(') ++r;
        else {
            if (r>0) --r;
            else ++l;
        }
    }
    rep(i,l) cout << '(';
    cout << s;
    rep(i,r) cout << ')';
    cout << endl;
}

Measured memory_bytes: 256
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumOdd(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a % 2
  }
  return sum
}
type BinaryIndexedTree []int
func (BIT BinaryIndexedTree) Get(idx int) int {
  b := 0
  for i := idx; 0 < i; i -= i & (-i) {
    b += BIT[i]
  }
  return b
}
func (BIT *BinaryIndexedTree) Update(idx, v int) {
  N := len((*BIT))
  d := v - BIT.Get(idx) + BIT.Get(idx - 1)
  for i := idx; i < N; i += i & (-i) {
    (*BIT)[i] += d
  }
}
func (BIT BinaryIndexedTree) Query(s, t int) int {
  return BIT.Get(t) - BIT.Get(s)
}
func (BIT *BinaryIndexedTree) Increment(idx int) {
  N := len((*BIT))
  for i := idx; i < N; i += i & (-i) {
    (*BIT)[i]++
  }
}
func InitBIT(N int) BinaryIndexedTree {
  BIT := make([]int, N + 1)
  return BIT
}

type Sequence [][]int
func (S Sequence) Len() int { return len(S) }
func (S Sequence) Less(i, j int) bool {
  if S[i][0] == S[j][0] { return S[i][1] < S[j][1] }
  return S[i][0] < S[j][0]
}
func (S Sequence) Swap(i, j int) { S[i], S[j] = S[j], S[i] }

func Inversion(A []int) int {
  N := len(A)
  BIT := InitBIT(N)
  I := 0
  B := make([][]int, N)
  for i, a := range A {
    B[i] = []int{a, i + 1}
  }
  sort.Sort(Sequence(B))
  for _, b := range B {
    I += BIT.Query(b[1], N)
    BIT.Update(b[1], 1)
  }
  return I
}

func Solve() {
  S := NextLine()
  N := len(S)
  C := make([]int, 26)
  for _, s := range S {
    C[int(s) - int('a')]++
  }
  if 1 < SumOdd(C...) {
    Write(-1)
    return
  }
  T := make([]int, N)
  P := make([]int, 26)
  Q := make([][]int, 26)
  for i, c := range C {
    Q[i] = make([]int, c / 2)
  }
  cnt := 0
  for i, s := range S {
    n := int(s) - int('a')
    if 0 < C[n] % 2 && P[n] == C[n] / 2 {
      T[i] = N / 2
    } else if P[n] < C[n] / 2 {
      T[i] = cnt
      Q[n][P[n]] = cnt
      cnt++
    } else {
      T[i] = N - 1 - Q[n][C[n] - P[n] - 1]
    }
    P[n]++
  }
  Write(Inversion(T))
  return
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 12928
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int n = scan.nextInt();
        int cnt = 0;
        
        for( ; n > 0 ; n-- ){
          cnt += n;
        }
            
        System.out.println(cnt);
	  }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if (n == 3) {
    cout << "2 5 63" << endl;
    return 0;
  }
  if (n == 4) {
    cout << "2 5 20 63" << endl;
    return 0;
  }
  if (n == 5) {
    cout << "2 5 20 30 63" << endl;
    return 0;
  }
  vector<int> ans;
  ll sum = 0;
  rep(i, 30001) {
    if (i > 1 && (i%2 == 0 || i%3 == 0)) {
      ans.push_back(i);
      sum += i;
    }
    if (ans.size() == n)
      break;
  }
  auto it = ans.begin();
  if (sum%6 == 2) {
    while (*it != 8)
      it++;
    ans.erase(it);
    for (int i = ans.back()+1; i <= 30000; i++) {
      if (i%6 == 0) {
        ans.push_back(i);
        break;
      }
    }
  } else if (sum%6 == 3) {
    while (*it != 9)
      it++;
    ans.erase(it);
    for (int i = ans.back()+1; i <= 30000; i++) {
      if (i%6 == 0) {
        ans.push_back(i);
        break;
      }
    }
  } else if (sum%6 == 5) {
    while (*it != 9)
      it++;
    ans.erase(it);
    for (int i = ans.back()+1; i <= 30000; i++) {
      if (i%6 == 4) {
        ans.push_back(i);
        break;
      }
    }
  }
  rep(i, ans.size()) {
    if (i)
      cout << ' ';
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int mod=1000000007;
ll dp[2][200000],m[200000];
vector<int> v;
int n,k;
int main(){
    cin>>n>>k;
    for(int i=1;i*i<=n;++i){
        v.pb(i);
        v.pb(n/i);
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    int sz=v.size();
    m[0]=1;dp[0][0]=1;
    FOR(i,1,sz) m[i]=v[i]-v[i-1],dp[0][i]=m[i];
    int nx;
    FOR(i,1,k){
        nx=(i&1);
        ll sum=0;
        memset(dp[nx],0,sizeof(dp[nx]));
        rep(j,sz){
            sum+=dp[nx^1][j];sum%=mod;
            dp[nx][sz-j-1]+=sum*m[sz-j-1]%mod;
            dp[nx][sz-j-1]%=mod;
        }
    }
    ll ans=0;
    rep(i,sz) ans+=dp[nx][i];
    cout<<ans%mod<<endl;
    return 0;
}


Measured memory_bytes: 4220
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	string s;
	cin >> n >> s;
	
	for(int i = 0; i < s.size(); ++i) {
		cout << char((s[i] - 'A' + n) % 26 + 'A');
	}
	
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong k;
llong a[100005];

llong res(llong x) {
    for (int i = 0; i < k; i++) {
        x -= x % a[i];
    }
    return x;
}

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

    llong minv;
    llong maxv;

    {
        llong valid, invalid;
        valid = 1ll << 60ll;
        invalid = 0;

        while (valid - invalid > 1) {
            llong mid = (valid + invalid) / 2;
            if (res(mid) >= 2) {
                valid = mid;
            }
            else {
                invalid = mid;
            }
        }
        minv = valid;
    }
    {
        llong valid, invalid;
        valid = 0;
        invalid = 1ll << 60ll;

        while (invalid - valid > 1) {
            llong mid = (valid + invalid) / 2;
            if (res(mid) > 2) {
                invalid = mid;
            }
            else {
                valid = mid;
            }
        }
        maxv = valid;
    }

    if (res(minv) != 2) cout << -1 << endl;
    else cout << minv << ' ' << maxv << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+50,M=4040,mod=1e9+7,L=2000;
int n,a[N],b[N],f[M][M],ans,J[N],I[N];
int C(int n,int m){return 1ll*J[n]*I[m]%mod*I[n-m]%mod;}
int main(){
	scanf("%d",&n);J[0]=I[0]=I[1]=1;
	for(int i=2;i<=4*L;i++)I[i]=mod-1ll*mod/i*I[mod%i]%mod;
	for(int i=1;i<=4*L;i++)J[i]=1ll*J[i-1]*i%mod,I[i]=1ll*I[i-1]*I[i]%mod;
	for(int i=1;i<=n;i++)scanf("%d%d",&a[i],&b[i]);
	for(int i=1;i<=n;i++)f[L-a[i]][L-b[i]]++;
	for(int i=0;i<=2*L;i++)for(int j=0;j<=2*L;j++){
		if(i)(f[i][j]+=f[i-1][j])%=mod;
		if(j)(f[i][j]+=f[i][j-1])%=mod;
	}
	for(int i=1;i<=n;i++)(ans+=f[L+a[i]][L+b[i]]-C(2*(a[i]+b[i]),2*a[i]))%=mod;
	printf("%d\n",(1ll*ans*I[2]%mod+mod)%mod);
	return 0;
}

Measured memory_bytes: 65664
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		string S = Console.ReadLine();
		int K = Int32.Parse(Console.ReadLine()) - 1;
		
		StringBuilder ans = new StringBuilder(N);
		for(int i = 0; i < N; i++)
			ans.Append((S[i] == S[K]) ? S[K].ToString() : "*");
		
		Console.WriteLine(ans);
	}	
}





Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define INFLL 0x3fffffffffffffffLL
#define INF 0x3f3fffff
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define exist(s,e) (s.find(e)!=s.end())
#define ff first
#define ss second
#define EPS 1e-8
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
const ll MOD=1000000007;
/////////////////// DEBUG MODE ///////////////////////////////////
#define D(x) cerr<<"DEBUG: "<<#x<<" is: "<<x<<'\n'
#define error(args...) {string _s=#args; replace(all(_s),',',' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string>) { cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
/////////////////// GLOBAL VARIABLES /////////////////////////////
vector<vector<int>> adj; vector<bool> vis;
/////////////////// FUNCTIONS ////////////////////////////////////
ll mexp(ll x, ll n, ll m){
  ll res=1;  while(n){if(n&1) res=(res*x)%m;n>>=1; x=((x%m)*(x%m))%m;}
  return res;
}
bool ispow2(ll x){ return x && (!(x&(x-1)));}
/////////////////// MAIN STARTS //////////////////////////////////
int main(){
  ios::sync_with_stdio(0);  cin.tie(0); cout<<fixed;   cerr<<fixed;
  cout<<setprecision(14); cerr<<setprecision(3);
  #ifdef DEBUG
  freopen("ip.txt","r",stdin); //freopen("op.txt","w",stdout);
  clock_t tStart = clock();
  #endif

	ll a,b,c,t,ans=0; cin>>a>>b>>c>>t;
	vector<ll> v(11); v[0]=1;
	for(int i=1;i<=10;++i) v[i]=2*v[i-1];
	for(int i=0;i<=10;++i){
		for(int j=0;j<=10;++j){
			for(int k=0;k<=10;++k){
				if(i+j+k>t) continue;
				ans=max<ld>(ans,a*v[i]+b*v[j]+c*v[k]);
				//error(ans,i,j,k);
			}
		}
	}
	cout<<ans<<'\n';

	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
  return 0;
}


Measured memory_bytes: 256
import math
import sys

input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
X = [sum(A)] * N
for i in range(2, N, 2):
    X[0] -= 2 * A[i - 1]
for i in range(1, N):
    X[i] = 2 * A[i - 1] - X[i - 1]
print(*X)


Measured memory_bytes: 60260
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;

/** Problem0205 : Rock, Paper, Scissors **/
int main()
{
	int pl[5];
	while (cin>>pl[0], pl[0]!=0) {
		REP(i, 1, 5) cin >> pl[i];
		int r=0, p=0, c=0;
		rep(i, 5) {
			switch (pl[i]) {
				case 1: r++; break;
				case 2: c++; break;
				case 3: p++; break;
			}
		}
		if (r>0 && c>0 && p>0) {
			rep(i, 5) cout << 3 << endl;
		} else if (r==5 || c==5 || p==5) {
			rep(i,5) cout << 3 << endl;
		} else {
			if (r==0) {
				rep(i, 5)
				if (pl[i]==2) cout << 1 << endl;
				else		  cout << 2 << endl;
			} else if (c==0) {
				rep(i, 5)
				if (pl[i]==3) cout << 1 << endl;
				else		  cout << 2 << endl;
			} else {
				rep(i, 5)
				if (pl[i]==1) cout << 1 << endl;
				else		  cout << 2 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		class qube{
			Scanner sc = new Scanner(System.in);
			int [] face = new int[6],faces = new int[6];
			Integer i,j,dump=0,check;

			qube(){
				for(i=0;i<6;i++){
					face[i]=sc.nextInt();
				}
				for(i=0;i<6;i++){
					faces[i]=sc.nextInt();
				}
			}

			void swap(int a,int b){
				dump = this.face[a];
				this.face[a] = this.face[b];
				this.face[b] = dump;

			}

			void move(String es){
				if(es.equals("E")){
					swap(0,2);
					swap(0,5);
					swap(0,3);
				}
				else if(es.equals("N")){
					swap(4,5);
					swap(4,1);
					swap(4,0);
				}

			}
			boolean comp(){
				check = 0;
				for(i=0;i<3;i++){
					for(j=0;j<3;j++){
						if(face[i]==faces[j] && face[5-i]==faces[5-j]){
							check++;
							break;
						}
					}
				}
				if(check == 3){
					return true;
				}
				else{
					return false;
				}
			}

		}
		Integer k;

		qube q = new qube();
		for(k=0;;k++){
			if(q.faces[1]==q.face[1]){
				break;
			}
			q.move("N");
			if(k.equals(3)){
				q.move("E");
			}
		}
		while(true){
			if(q.faces[0]==q.face[0]){
				break;
			}
			q.move("E");
		}
		if(q.comp() == true){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 26460