akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using llong = long long;

void fnInput(int& rnLeft, int& rnRigt)
{
  cin >> rnLeft >> rnRigt;
}
  
int fnMinRemain2019(int nLeft, int nRigt)
{
  if (nLeft + 2018 < nRigt) return 0;          // 2019 で割り切れる数が存在

  int nMinRem2019 = 2018;

  for (int i = nLeft; i < nRigt; i++)
    for (int j = i + 1; j < nRigt + 1; j++)
    {
      int nRem2019 = (llong)i * j % 2019;
      nMinRem2019 = min(nMinRem2019, nRem2019);
    }

  return nMinRem2019;
}
  
int main()
{
  int nLeft, nRigt;
  fnInput(nLeft, nRigt);
  cout << fnMinRemain2019(nLeft, nRigt) << endl;

  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<long long> b(n+1);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        b[a[i]]++;
    }
    long long c = 0;
    long long d = 0;
    for(int i = 0; i < n + 1; i++) {
        c += b[i] * (b[i] - 1) / 2;
    }
    for(int i = 0; i < n; i++) {
        d = (b[a[i]] * (b[a[i]] - 1) / 2) - (b[a[i]] - 1) * (b[a[i]] - 2) / 2;
        cout << c - d << endl;
    }
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#define ll long long
#define rep(i, a, b) for(int i = a; i <= (int)b; i++)
void read(int &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
void read(ll &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
using namespace std;
const int maxn = 100010;
int n, a[maxn], x[maxn];
ll s;
int main()
{
	read(n);
	rep(i, 1, n) read(a[i]), s += a[i];
	s /= 2;
	rep(i, 1, n) if(!(i & 1)) s -= a[i];
	x[1] = s * 2;
	rep(i, 1, n - 1) {
		x[i + 1] = 2 * a[i] - x[i];
	}
	rep(i, 1, n) printf("%d ", x[i]);
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef double ld;
int vis[301][301][301];
ld mem[301][301][301];
ld n;
ld dp(int a, int b, int c ){
    if(a<0||b<0||c<0)
        return 0;
    if(a+b+c==0){
        return 0;
    }
    if(vis[a][b][c]){
        return mem[a][b][c];
    }
    ld res=0;
    res=(ld)(a)*dp(a-1,b,c)+(ld)(b)*dp(a+1,b-1,c)+(ld)(c)*dp(a,b+1,c-1)+n;
    res=res/(ld)(a+b+c);
    vis[a][b][c]=1;
    mem[a][b][c]=res;
    return res;
}
int main(){
    int m;
    while(cin>>n){
        int cnt[4]={0}, x;
        for(int i=0; i<n; ++i){
            scanf("%d",&x);
            ++cnt[x];
        }
        ld ans=0;
        ans=dp(cnt[1],cnt[2], cnt[3]);
        cout<<fixed<<setprecision(12)<<ans<<endl;
    }
  return 0;
}




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

using namespace std;

#define pb push_back
#define mp make_pair
constexpr int INF = 1 << 29;
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;

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

int main() {
	int A, B;
	cin >> A >> B;
	A--, B--;
	vector<vector<int>> ans(100, vector<int>(100, 0));

	for(int i = 0; i < 50; i++) {
		for(int j = 0; j < 100; j++) {
			ans[i][j] = 1;
		}
	}

	for(int i = 0; i < 50; i += 2) {
		for(int j = 0; j < 100; j += 2) {
			if (A > 0) {
				ans[i][j] = 0;
				A--;
			}
		}
	}
	for(int i = 51; i < 100; i += 2) {
		for(int j = 0; j < 100; j += 2) {
			if (B > 0) {
				ans[i][j] = 1;
				B--;
			}
		}
	}

	cout << "100 100" << endl;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			cout << (ans[i][j] == 1 ? "#" : ".");
		}
		cout << endl;
	}

	return 0;
}


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

int main() {
    int H, W;

    while (true) {
        cin >> H >> W;
        
        if (H == 0 && W == 0) break;
        
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i % 2 == 0) {
                    if (j % 2 == 0) {
                        cout << '#';
                    }
                    else {
                        cout << '.';
                    }
                }
                else {
                    if (j % 2 == 1) {
                        cout << '#';
                    }
                    else {
                        cout << '.';
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)

int main(){
	vector<int> a,b;
	int n,m;
	cin>>n;
	lp(i,n){
		int hoge;
		cin>>hoge;
		a.push_back(hoge);
	}
	cin>>m;
	lp(i,m){
		int hoge;
		cin>>hoge;
		b.push_back(hoge);
	}
	vector<int> ans;
	set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(ans,ans.end()));
	for_each(ans.begin(),ans.end(),[](int hoge){ cout<<hoge<<endl;});
	return 0;
}


Measured memory_bytes: 6504
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);
    CINS(int, V, N);
    vector<int> a0(1e5+1, 0);
    vector<int> a1(1e5+1, 0);

    for (int i = 0; i < N; i++) {
        if ( i % 2 == 0 ) {
            a0[V[i]]++;
        } else {
            a1[V[i]]++;
        }
    }

    int max0 = 0, maxi0, max1 = 0, maxi1;
    for (int i = 0; i < 1e5+1; i++) {
        if ( max0 < a0[i] ) {
            max0 = a0[i];
            maxi0 = i;
        }
    }
    for (int i = 0; i < 1e5+1; i++) {
        if ( max1 < a1[i] ) {
            max1 = a1[i];
            maxi1 = i;
        }
    }

    sort(a0.begin(), a0.end());
    reverse(a0.begin(), a0.end());
    sort(a1.begin(), a1.end());
    reverse(a1.begin(), a1.end());

    int ans = 0;
    if ( maxi0 != maxi1 ) {
        ans = (N / 2 - a0[0]) + (N / 2 - a1[0]);
    } else {
        int ans0, ans1;
        ans0 = (N / 2 - a0[1]) + (N / 2 - a1[0]);
        ans1 = (N / 2 - a0[0]) + (N / 2 - a1[1]);
        ans = min(ans0, ans1);
    }

    cout << ans << "\n";
    return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[10][10];

ll front(ll n) {
    ll p = n % 10;
    while (n > 0) {
        p = n % 10;
        n /= 10;
    }
    return p;
}

ll back(ll n) {
    return n % 10;
}

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    memset(A, 0, sizeof(A));
    for (ll n = 1; n <= N; ++n) {
        ll f = front(n);
        ll b = back(n);
        A[f][b]++;
    }
    for (ll n = 1; n <= N; ++n) {
        ll f = front(n);
        ll b = back(n);
        ans += A[b][f];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,x,max=0,t=0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> x;
        t+=x;
        if(max < x){
            max=x;
        }
    }
    if(t>2*max){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import heapq
N = int(input())
A = list(map(int, input().split()))
R = A[:N]
B = [-a for a in A[2 * N:]]
heapq.heapify(R)
heapq.heapify(B)
R_sum = [sum(R)]
B_sum = [sum(B)]

for i in range(N, 2 * N):
    heapq.heappush(R, A[i])
    q = heapq.heappop(R)
    R_sum.append(max(R_sum[-1], R_sum[-1] + A[i] - q))

for i in range(2 * N - 1, N - 1, -1):
    heapq.heappush(B, -A[i])
    q = heapq.heappop(B)
    B_sum.append(max(B_sum[-1], B_sum[-1] - A[i] - q))

num = -float("inf")
for p, q in zip(R_sum, B_sum[::-1]):
    num = max(num, p + q)

print(num)

Measured memory_bytes: 38288
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(void){
	int n,k,add;
	cin >>n >> k ;
	vector<int> v(n);
	
	for(int i=0;i<n;i++){
		cin >> v[i];
		add+=2*min(fabs(v[i]),fabs(v[i]-k));
	}
	cout << add;
}


Measured memory_bytes: 256
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#include<unordered_set>
using namespace std;

namespace _ {
	bool rEOF = 1;//为0表示文件结尾
	inline char nc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return p1 == p2 && rEOF && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? (rEOF = 0, EOF) : *p1++;
	}
	template<class _T>
	inline bool read(_T &num) {
		char c = nc(), f = 1; num = 0;
		while (c<'0' || c>'9')c == '-' && (f = -1), c = nc();
		while (c >= '0'&&c <= '9')num = num * 10 + c - '0', c = nc();
		return (bool)(num *= f);
	}
	inline bool need(char &c) { return c >= 'a'&&c <= 'z' || c >= '0'&&c <= '9' || c >= 'A'&&c <= 'Z'; }//读入的字符范围
	inline bool read_str(char *a) {
		while ((*a = nc()) && need(*a) && rEOF)++a;
		*a = '\0'; return rEOF;
	}
}using namespace _;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		//freopen("out.txt", "w", stdout);
	}
}



int main()
{
	int x, k;
	cin >> k >> x;
	for (int i = x - k + 1; i <= x + k - 1; i++)
		printf("%d%c", i, " \n"[i == x + k - 1]);


	return 0;
}

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

#define ll long long
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
// #define forn(i,n) for(ll i=0; i<(n); i++)
#define forn for(ll i=0; i<(n); i++)
#define fori(i,k,n) for(ll i=k; i<(n); i++) 
#define all(x) (x).begin(),(x).end()
#define en '\n'
#define FILL(x,v) memset(x,v,sizeof(x))
#define pb push_back


template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
 
template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
 
template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}
void min_self(int &a, int b){
	a = min(a, b);
}

const int INF = 1e9 + 5;

void solve(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	while(a > 0 && c > 0){
		c-=b;
		if(c <= 0) {
			cout << "Yes" << en;
			break;
		}
		a-=d;
		if(a <= 0){
			cout << "No" << en;
			break;
		}
	}
}

int main(){
    ios::sync_with_stdio(0);
	cin.tie(0);
    cout.tie(0);
 
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<cmath>

using namespace std;

int main()
{
	int A, B, X;
	cin >> A >> B >> X;

	if (A > X || A + B < X)
	{
		cout << "NO" << endl;
	}
	else
	{
		cout << "YES" << endl;
	}

	return 0;
}

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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1e9+7;

int main() {
	string s;
	cin  >> s;
	ll stack=0;ll syokyo=0;
	for (int i = 0;i < s.size();i++) {
		if (s[i] == 'S') {stack++;}
		else if (stack > 0) {stack--;syokyo++;}
	}
	cout << s.size() - syokyo*2 << endl;
}

Measured memory_bytes: 640
S=input()
ans=0
for i in range(1<<(len(S)-1)):
    j=format(i,"b").zfill(len(S)-1)
    s,memo=S,0
    for n in range(len(S)-1):
        if j[n]=="0":memo+=1
        else:
            ans+=int(s[:memo+1])
            s=s[memo+1:]
            memo=0
    ans+=int(s)
print(ans)

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}


const ll MOD = 998244353;

const int SZ = 812345;
ll inv[SZ];
ll fact[SZ];
ll fact_inv[SZ];
ll choose(int n, int r) {
  if (n < 0 || r < 0 || n < r) return 0;
  return fact[n] * fact_inv[n-r] % MOD * fact_inv[r] % MOD;
}

ll mod_pow(ll a, ll b, ll p) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    a = (a * a) % p;
    b >>= 1;
  }
  return res;
}

int main2() {
  int N = nextInt();
  int M = nextInt();
  int K = nextInt();

  ll ans = 0;
  for (int k = 0; k <= K; k++) {


    int n = N - k;
    ll val = 1;
    val *= M;
    val %= MOD;

    val *= mod_pow(M-1, n-1, MOD);
    val %= MOD;

    val *= choose(N-1, k);
    val %= MOD;



    ans += val;
    ans %= MOD;
  }


  cout << ans << endl;
  return 0;
}

int main() {
  inv[1] = 1;
  for (int i = 2; i < SZ; i++) inv[i] = inv[(int) (MOD % i)] * (MOD - MOD / i) % MOD;
  fact[0] = 1;
  for (int i = 1; i < SZ; i++) fact[i] = fact[i-1] * i % MOD;
  fact_inv[0] = 1;
  for (int i = 1; i < SZ; i++) fact_inv[i] = fact_inv[i-1] * inv[i] % MOD;

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 22804
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define link(x) for(edge *j=h[x];j;j=j->next)
#define inc(i,l,r) for(int i=l;i<=r;i++)
#define dec(i,r,l) for(int i=r;i>=l;i--)
const int MAXN=3e5+10;
const double eps=1e-8;
const int mod=1e9+9;
#define ll long long
using namespace std;
struct edge{int t,v;edge*next;}e[MAXN<<1],*h[MAXN],*o=e;
void add(int x,int y,int vul){o->t=y;o->v=vul;o->next=h[x];h[x]=o++;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return x*f;
}


int n,a[MAXN];

map<int,int>ma;

int main(){
    n=read();
    inc(i,1,n)a[i]=read();
    ll ans=0;
    inc(i,1,n){
	if(ma.count(i-a[i]))ans+=ma[i-a[i]];
	ma[i+a[i]]++;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 13736
n = int(input())
x = [int(input()) for i in range(n)]
a = sum(x)
if a%10 != 0:
	print(a)
else:
	x.sort()
	for i in x:
		if i%10 != 0:
			answer = a-i
			break
		else:
			answer = 0
	print(answer)

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

int main() {
    int n, l;
    cin >> n >> l;
    string s[n];
    rep(i, n) cin >> s[i];
    sort(s, s + n);

    string ans;
    rep(i, n) ans += s[i];

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  for (int i = 0; i < H; i++) {
    cin >> a[i];
  }
  vector<string> red(H, string(W, '.')), blue(H, string(W, '.'));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (j == 0) {
        red[i][j] = '#';
      } else if (j == W - 1) {
        blue[i][j] = '#';
      } else if (i % 2 == 0) {
        red[i][j] = '#';
      } else if (i % 2 == 1) {
        blue[i][j] = '#';
      }
      if (a[i][j] == '#') {
        if (i % 2 == 0) {
          blue[i][j] = '#';
        } else {
          red[i][j] = '#';
        }
      }
    }
  }
  for (int i = 0; i < H; i++) {
    cout << red[i] << endl;
  }
  for (int i = 0; i < H; i++) {
    cout << blue[i] << endl;
  }
  return 0;
}


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

int main() {
	int K, S;

	cin >> K >> S;

	int ans = 0;
	for( int x = 0; x <= K; x++ ) {
		for( int y = 0; y <= K; y++ ) {
			int z = S - (x + y);
			if( 0 <= z && z <= K ) {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n + 1];
    for(int i = 1; i <= n; i++){
      a[sc.nextInt()] = i;
    }
    for(int i = 1; i <= n; i++){
      System.out.println(a[i] + " ");
    }
  }
}
      

Measured memory_bytes: 62900
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;
int INF=10000;
int dp[401][401][41];

int main(){
    int n,ma,mb;cin>>n>>ma>>mb;
    int a[n+1],b[n+1],c[n+1];for(int i=1;i<=n;i++)cin>>a[i]>>b[i]>>c[i];
    
    for(int i=0;i<=400;i++)for(int j=0;j<=400;j++)for(int k=0;k<=n;k++)dp[i][j][k]=INF;
    dp[0][0][0]=0;
    for(int i=0;i<=400;i++)for(int j=0;j<=400;j++)for(int k=1;k<=n;k++){
        if(i<a[k]||j<b[k])dp[i][j][k]=dp[i][j][k-1];
        else dp[i][j][k]=min(dp[i][j][k-1],dp[i-a[k]][j-b[k]][k-1]+c[k]);
    }
    int min=INF;
    for(int i=1;i<=400/(max(ma,mb));i++){
        if(dp[i*ma][i*mb][n]<min)min=dp[i*ma][i*mb][n];
    }
    if(min==INF)cout<<"-1"<<endl;
    else cout<<min<<endl;
    return 0;
}



Measured memory_bytes: 25984
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
#define INF 1e14
typedef long long int ll;
ll fast(ll n,ll a)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll res=fast(n/2,a)%Mod;
        if(n%2==0)
        {
            return (((res%Mod)*(res%Mod))%Mod);
        }
        else{
            return (((((res%Mod)*a)%Mod)*res)%Mod);
        }
    }
}

int main()
{
    ll n;
    cin>>n;
    cout<<n*n*n<<"\n";


}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <climits>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF 1000000001
#define endl "\n"
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
#define SIZ(x) ((int)(x).size())
typedef long long int lli;
using namespace std;

int main()
{
  int A,B,C;
  cin >> A >> B >> C;
  
  if( A == B and B == C )
    {
      cout << "Yes" << endl;
      
    }
  else
    {
      cout << "No" << endl;
      
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc163/abc163_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  printf("%f", N * 2 * 3.14159);
}

Measured memory_bytes: 3780
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
from fractions import gcd
#import random


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['Yes', 'No']
MOD = 10**9+7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)


show_flg = False
# show_flg = True


def main():
    S = input()
    N = len(S) - 1

    total = 0
    for i in range(2 ** N):
        splits = []
        # print("pattern {}: ".format(i), end="")
        for j in range(N):
            if ((i >> j) & 1):
                splits.append(j)
        splits.append(len(S))

        for j in range(len(splits)):
            n = splits[j]
            if j == 0:
                total += int(S[:n+1])
                # print(S[:n+1])
            else:
                prev = splits[j-1]
                # print(prev, n, S[prev+1:n+1])
                total += int(S[prev+1:n+1])

    print(total)


if __name__ == '__main__':
    main()


Measured memory_bytes: 66156
N = int(input())
A = []
A_max = -1
index = 0
for i in range(N):
  a = int(input())
  if A_max <= a:
    A_max,index = a,i
  A.append(a)

for i in range(N):
  if i == index:
    A.pop(i)
    print(max(A))
  else:
    print(A_max)
    
  


Measured memory_bytes: 12512
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb push_back;
#define sp " ";
lli mod=1000000007;
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
struct modint{
    long long int x;
    modint(long long int x=0):x(x%mod){}//メンバ変数を初期化する。
    modint& operator+= (const modint a){
        if((x+=a.x)>=mod){x-=mod;}//%は遅い
        return *this;//関数を終了するためにはreturnを返さなければならないが、return aとでもするとその値が代入されてしまう。そこで、計算された後の自分自身のアドレス、つまり何もしないようにしている？
    }
    modint& operator-= (const modint a){
        if((x+=mod-a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator*= (const modint a){
        x*=a.x;
        x%=mod;
        return *this;
    }
    modint operator+(const modint a) const{//引数の横のconstは関数自体がconstつまりメンバ変数の変更ができなくなるということ。バグ防止に役立つ
        modint copy(*this);//constがあるのでメンバ変数をいじれないから値だけコピーする
        return copy+=a;
    }
    modint operator-(const modint a)const{
        modint copy(*this);
        return copy+=a;
    }
    modint operator*(const modint a)const{
        modint copy(*this);
        return copy*=a;
    }
    modint pow(long long int t)const{//繰り返し二乗法
        if(t==0) return 1;
        modint a=pow(t>>1);//tを1/2倍したものの累乗
        a*=a;//aを二乗する
        if(t&1) a*=*this;//ビット形式での一桁目が1、つまりtが奇数ならば、もう一回掛ける。
        return a;
    }
    modint inv() const{
        return pow(mod-2);
    }
    modint operator/=(const modint a){
        return (*this)*=a.inv();
    }
    modint operator/(const modint a){
        modint copy(*this);
        return copy/=a;
    }
};

struct combination {
    vector<modint> fact,ifact;//階乗＝factoria
    combination(int n):fact(n+1),ifact(n+1){//fact=階乗、ifactはその逆元
        fact[0]=1;//0!=1
        for(int i=1;i<=n;i++) fact[i]=fact[i-1]*i;
        ifact[n]=fact[n].inv();//invは計算が重いので一回で済ませたい
        for(int i=n;i>=1;i--) ifact[i-1]=ifact[i]*i;
    }
    modint operator()(int n,int k){
        if(k<0||k>n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
combination s(2000005);
modint g(lli r,lli c){
    return s(r+c+2,r+1)-1;
}
int main(){
    modint ans=0;
    lli r1,r2,c1,c2;
    cin>>r1>>c1>>r2>>c2;
    --r1;--c1;
    ans=g(r2,c2);
    ans-=g(r1,c2);
    ans-=g(r2,c1);
    ans+=g(r1,c1);
    cout<<ans.x<<endl;
}

Measured memory_bytes: 31488
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		boolean can = false;

		for (int i = 0; i*4 <= N; i++) {
			for (int j = 0; i*4 + j*7 <= N; j++) {
				if ((N - i*4) % 7 == 0 ) {
					can = true;
					break;
				}
			}
		}

		if (can) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

int main(void){
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
        long long b; cin >> b;
        if (b == 0) {cout << 0 << endl; return 0;}
        a.at(i) = b;
    }
    
    long long m = 1;
    for (int i = 0; i < n; i++ ) {
        if(a.at(i) > 1000000000000000000/m) {cout << -1 << endl; return 0;}
        else if (m > 1000000000000000000) {cout << -1 << endl; return 0;}
        m *= a.at(i);
    }
    cout << m << endl;
}


Measured memory_bytes: 4056
/*

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

using namespace std;
using ll=long long;
#define r(i,n) for(int i=0;i<(n);i++)
#define r2(i,a,n) for(int i=(a);i<(n);i++)
#define re(i,a) for(auto &i:a)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int k;cin>>k;
  string s="";
  r(i,k)s+="ACL";
  cout<<s<<endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}


int main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    REP(i,n){
        cin >> x[i];
    }
    ll ans=INF;
    REP(i,101){
        ll tmp=0;
        REP(j,n){
            tmp+=abs(x[j]-i)*abs(x[j]-i);
        }
        if(ans>tmp){
            ans=tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())
    S = readline().rstrip().decode()
    if N % 2 != 0:
        print('No')
    elif S[:N//2] == S[N//2:]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import bisect
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=[0 for i in range(N+1)]
D=[0 for j in range(M+1)]
C[0]=0
for i in range(1,N+1):
    C[i]=A[i-1]+C[i-1]
D[0]=0
for i in range(1,M+1):
    D[i]=B[i-1]+D[i-1]
count=0
for i in range(N+1):
    rest_time=K-C[i]+0.5
    if rest_time>0:
      j=bisect.bisect_left(D,rest_time)-1
      count=max(count,i+j)
print(count)

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

int main(){
  int n,s,w,q,a[100100];
  while(cin >> n >> s >> w >> q, n){
    int g = s;
    rep(i,n){
      a[i] = (g/7) % 10;
      g = (g/2) ^ ((g%2)*w);
    }

    int ans = 0, non_zeros = 0;
    if(q==2 || q==5){
      rep(i,n){
	if(a[i])non_zeros++;
	if(a[i]%q == 0)ans += non_zeros;
      }
    }else{
      map<int,int> memo;
      memo[0] = 1;
      int rem = 0, k = 1;
      for(int i=n-1;i>=0;i--){
	rem = (rem + a[i] * k) % q;
	(k *= 10) %= q;
	if(a[i])ans += memo[rem];
	memo[rem]++;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 5804
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 1000005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

bool prime[N];
vector<ll> factor[N];

ll primes[N];

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  memset(prime, true, sizeof(prime));
  for (ll i = 2; i < N; i++) {
    if (prime[i]) {
      for (ll j = i; j < N; j += i) {
        prime[j] = false;
        factor[j].push_back(i);
      }
    }
  }

  ll n;
  cin >> n;

  ll arr[n + 5];

  ll part2 = 0;

  memset(primes, 0, sizeof(primes));
  for (ll i = 1; i <= n; i++) {
    cin >> arr[i];
    part2 += power(arr[i], mod - 2, mod);
    if (part2 >= mod)
      part2 -= mod;

    for (ll x : factor[arr[i]]) {
      ll curr = arr[i];
      ll cnt = 0;
      while (curr % x == 0) {
        curr /= x;
        cnt++;
      }
      primes[x] = max(primes[x], cnt);
    }
  }

  ll res = 1;
  for (ll i = 1; i < N; i++) {
    if (primes[i] == 0)
      continue;

    res *= power(i, primes[i], mod);
    res %= mod;
  }

  cout << res * part2 % mod << en;

  return 0;
}

Measured memory_bytes: 78976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    int a[101000];
    int x[101000];
    ll sum = 0;
    ll tmp = 0;
    
    cin >> n;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    
    sum /= 2;
    
    for (int i = 0; i < n; i += 2) {
        tmp += a[i];
    }
    
    x[0] = tmp - sum;
    
    rep(i, n) {
        x[(i + 1) % n] = a[i] - x[i];
    }
    
    rep(i, n) {
        cout << (x[i] * 2) << ((i == (n - 1)) ? "\n" : " ");
    }
    
    return 0;
}

Measured memory_bytes: 2176
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N 200005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"

const int inf = (int)1e18 + 10;

vecp v , idx;
int ans[100005] = {0};
signed main(){
  fast;
 
  string s;
  cin >> s;
  int n = s.length();
  int r = 0 , l = 0  , rj , lj;
  for(int i = 0 ; i < n ; i++){
  	  if(s[i] == 'R'){
         if(l > 0){
         	v.pb(mp(r , l));
         	idx.pb(mp(rj , lj));
         	r = 1;
         	l = 0;

         }
         else
         	r++;
  	  }
  	  else{
  	  	if(l == 0){
  	  		rj = i-1;
  	  		lj = i;}
  	  	l++;
  	  }

  }

  v.pb(mp(r , l));
  idx.pb(mp(rj , lj));

  for(int i = 0 ; i < v.size() ; i++){
  	   r = v[i].ff;
  	   l = v[i].ss;
  	   int j = max(l , r);
  	   j--;
       int tot = l + r;
  	   if(r < l)
  	   	r = tot/2 , l =  tot - r;
  	   else
  	   	 l = tot/2 , r = tot - l;
  	   
  	   if(j % 2 == 0){
  	   		ans[idx[i].ff] = r;
  	       ans[idx[i].ss] = l;
  	
  	   }
  	   else{
  	   		ans[idx[i].ff] = l;
  	    ans[idx[i].ss] = r;
  	
  	   }
  	   

  }


  for(int i = 0 ; i < n ; i++)
  	cout << ans[i] << " ";

  
}	

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll N;
    cin >> N;
    vector<ll> d(N);
    rep(i, N) cin >> d[i];
    ll ans = 0;
    rep(i, N - 1) {
        repd(j, i + 1, N) {
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;
    return 0;
}

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

int main() {
    int d; cin >> d;
    vector<int> c(26,0);
    vector<vector<int>> s(d,vector<int>(26,0));
    rep(i, 26) {
        cin >> c[i];
    }
    rep(i, d) {
        rep(j, 26) {
            cin >> s[i][j];
        }
    }
    vector<int> last(26,0);
    vector<int> t(d,0);

    rep(i, d) {
        long max = -1000000000000000000;
        rep(j, 26) {
            int x = 0;
            rep(k, 26) {
                x += c[k] * (i - last[k]);
            }
            int y = s[i][j] - x + c[j] * (i - last[j]);
            if (y > max) t[i] = j;
        }
        last[t[i]] = i;
    }

    rep(i, d) {
        printf("%d\n", t[i]+1);
    }
}

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

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

    int n;
    int a, b, c;
    while(cin>>a>>b>>c){
        n = 0;
        if (a == b) {
            ++n;
        }
        if(a==c){
            ++n;
        }
        if(b==c){
            ++n;
        }
       // cout << n << endl;
        if (n == 1) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  ho={}
  if n%2==0:
    for i in range(1,n//2+1):
      ho[str(i)+'-'+str(n-i+1)]=0
  else:
    for i in range(1,n//2+1):
      ho[str(i)+'-'+str(n-i)]=0

  # print(ho)

  ans=[]
  for i in range(1,n+1):
    for j in range(1,n+1):
      if i<=j:
        break

      pair=str(j)+'-'+str(i)
      if pair in ho:
        continue

      ans.append((j,i))

  print(len(ans))
  for x,y in ans:
    print(x,y)

main()
# print(main())


Measured memory_bytes: 6032
#include <cstdio>

using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	
	int mini = 2000000000;
	for(int i = 0; i < n; i++){
		int a;
		scanf("%d", &a);
		
		int cnt = 0;
		while(a % 2 == 0){
			a /= 2;
			cnt++;
		}
		if(cnt < mini)
			mini = cnt;
	}
	printf("%d\n", mini);


	return 0;
}

Measured memory_bytes: 128
def sm(x):
    xls = list(str(x))
    a = 0
    for i in range(len(xls)):
        a += int(xls[i])
    return a

N, A, B = map(int,input().split())
ans = 0
for i in range(1, N+1):
    if A <= sm(i) <= B:
        ans += i
print(ans)


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

#define int long long
#define double long double
#define incin(n) int (n); cin >> (n)
#define uniq(v) sort((v).begin(),(v).end()); (v).erase(unique((v).begin(),(v).end()),(v).end());
#define steprap(i,n,s) for(int (i)=0;i<(s)*(n);(i)+=(s))
#define rap(i,n) steprap((i),(n),1)

using intV = std::vector<int>;

using namespace std;
namespace math
{
	double PI = 3.14159265359;
	int step(int n);
	int ncr(int n,int r);
	int npr(int n,int r);
	int gcm(int a,int b);
	int lcm(int a,int b);

	int step(int n){
		if(n<=1){
			return 1;
		}else{
			return n * step(n-1);
		}
	}
	int ncr(int n,int r){
		for(int i=1;i<r;i++){
			n *= n-i;
		}
		for(int i=1;i<r;i++){
			r *= r-1;
		}
		return n/r;
	}
	int npr(int n,int r){
		for (int i = 1; i < r; ++i)
		{
			n *= n-1;
		}
		return n;
	}
	int gcm(int a,int b){
		int p=max(a,b);
		int q=min(a,b);
		int r;
		while(true){
			if(p%q==0){
				return q;
			}
			r = p%q;
			p=q;
			q=r;
		}
	}
}

using namespace std;
// using StringMap = std::vector<std::vector<char>> map(h+2,vector<char>(w+2,'#'));
namespace tmp {
    template <typename T> bool inArry(T x,vector<T> v);
    template <typename T> void input(int n,vector<T> &v);

    template <typename T> bool inArry(T x,vector<T> v){
        int l = v.size();
        for(int i=0;i<l;i++){
            if(x==v[i]){
                return true;
            }
        }
        return false;
    }
    
    template <typename T> void input(int n,vector<T> &v){
        for(int i=0;i<n;i++){
            cin >> v.at(i);
        }
    }
}

using namespace std;

signed main (){
	intV v(3,0);
	rap(i,3){
		cin >> v.at(i);
	}
	uniq(v);
	cout<<v.size()<<endl;
	return 0;
}


Measured memory_bytes: 256
/*
    author:ujwalll
*/
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std; 
#define rep(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
const int INF = 1<<29;
const int MOD=1073741824;
#define pp pair<ll,ll>
#define ppi pair<int,int>
typedef long long int ll;
bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
////////////////////////////////////////////////////////////////////

int main(){
    int tc=1;
    // cin>>tc;
    while(tc--){
        string s;
        cin>>s;
        ll n=0;
        for(int i=0;i<s.length();i++){
            n+=(s[i]-'0');
        }
        if(n%9)cout<<"No";
        else cout<<"Yes";
    }
}

Measured memory_bytes: 3748
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	k := getNextInt(scanner)
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	var sum int64
	for i := 0; i < k; i++ {
		aa, sum = update(n, aa)
		if sum == int64(n)*int64(n) {
			break
		}
	}
	for i := 0; i < n; i++ {
		fmt.Fprintln(writer, aa[i])
	}
}

func update(n int, aa []int) ([]int, int64) {
	bb := make([]int, n+1)
	for i := 0; i < n; i++ {
		l := i - aa[i]
		if l < 0 {
			l = 0
		}
		r := i + aa[i] + 1
		if r >= n {
			r = n
		}
		bb[l]++
		bb[r]--
	}
	sum := int64(bb[0])
	for i := 1; i < n; i++ {
		bb[i] += bb[i-1]
		sum += int64(bb[i])
	}
	return bb, sum
}


Measured memory_bytes: 12524
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int d, c;
	cin >> d >> c;
	cout << d*c << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	int a, b, k; std::cin >> a >> b >> k;
	if (b - a < 2 * k) {
		for (auto i = a; i <= b; ++i) {
			std::cout << i << '\n';
		}
	}
	else {
		for (auto i = a; i < a + k; ++i) {
			std::cout << i << '\n';
		}
		for (auto i = b - k + 1; i <= b; ++i) {
			std::cout << i << '\n';
		}
	}
}


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a + b + 1 >= c) {
		cout << b + c << endl;
	} else {
		cout << 2 * b + a + 1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const ll inf = 1e18;

ll pow(ll a, ll b, ll m)
{
    ll  ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int main()
{
	IOS;
	int t=1; //cin>>t;
	while(t--){
	  int n,w; cin>>n>>w;
	  int weight[n],value[n];
	  for(int i=0;i<n;i++) cin>>weight[i]>>value[i];
	  
	  ll dp[n+1][100005],ans=-1;
	  
	  for(int i = 0;i<=n;i++)	dp[i][0]=0;
	  for(int i = 0;i<100005;i++)	dp[0][i]=inf;
	  dp[0][0] = 0;
	
	  for(int i=1;i<=n;i++)
	  {
		 for(int j=1;j<100005;j++)
		 {
			// not take the current item
			dp[i][j] = dp[i-1][j];
			
			// take current if possible
			if(j >= value[i-1])
			dp[i][j] = min(dp[i][j],dp[i-1][j-value[i-1]]+weight[i-1]);
			
			if(i==n)
			{
				if(dp[i][j] <= w)
				 ans = j;
			} 
		 }
	  }	 
	  cout<<ans;
	  cout<<"\n";
	}    

}

Measured memory_bytes: 82528
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class home {
public:
	int time;
	int cost;
	home() :time(-1), cost(-1) {}
};

int main() {
	int n, m;
	while (cin >> n >> m&&n != 0) {
		vector<vector<home> > map(m + 1, vector<home>(m + 1));
		for (int i = 0; i < n; ++i) {
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			map[a][b].cost = c;
			map[b][a].cost = c;
			map[a][b].time = d;
			map[b][a].time = d;
		}
		bool flag = true;
		while (flag) {
			flag = false;
			for (int i = 1; i <= m - 1; ++i) {
				for (int j = i + 1; j <= m; ++j) {
					for (int k = 1; k <= m; ++k) {
						if (i == k || j == k)continue;
						if (map[i][k].cost == -1 || map[j][k].cost == -1)continue;
						if (map[i][k].time == -1 || map[j][k].time == -1)continue;
						int cost = map[i][k].cost + map[j][k].cost;
						int time = map[i][k].time + map[j][k].time;
						if (map[i][j].cost == -1 || map[i][j].cost > cost) {
							flag = true;
							map[j][i].cost = map[i][j].cost = cost;
						}
						if (map[i][j].time == -1 || map[i][j].time > time) {
							flag = true;
							map[i][j].time = map[j][i].time = time;
						}
					}
				}
			}
		}
		int num;
		cin >> num;
		for (int i = 0; i < num; ++i) {
			int a, b, c;
			cin >> a >> b >> c;
			if (c == 0) {
				cout << map[a][b].cost << endl;
			}
			else {
				cout << map[a][b].time << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

ll nck[5005][5005],dp[5005],fac[5005],inv[5005];
int main(){
  int n,a,b,c; scanf("%d%d%d%d",&n,&a,&b,&c);
  if(b%2==1){
    //assert(0);
    printf("0\n"); exit(0);
  }
  nck[0][0]=1;
  fac[0]=1;
  inv[0]=1;
  REPP(i,1,n+1){
    
    nck[i][0]=1;

    REPP(j,1,i+1) nck[i][j]=(nck[i-1][j]+nck[i-1][j-1])%mod;
  }
  b/=2;
  ll ans=0;
  REP(i,c+1){
    REP(j,i+1)if(i-j<=a){
      if(b) dp[i]+=nck[b+j-1][j]*nck[a][i-j]%mod*nck[b+a][a]%mod;
      else if(j==0) dp[i]+=nck[a][i-j]*nck[b+a][a]%mod;
    }
    dp[i]%=mod;
    //printf("%d %lld\n",i,dp[i]);
    if((c-i)%3==0){
      ans+=dp[i]*nck[a+b+(c-i)/3][a+b]%mod;
    }
  }
  printf("%lld\n",ans%mod);
  return 0;
}

Measured memory_bytes: 116992
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;

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


    

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

int main() {
  int n,h,c=0; cin>>n;
  vector<int> v(n);
  rep(i,n){
    cin>>v.at(i);
    if(i==0){h=v.at(0);c++;}
    else if(v.at(i)>=h){h=v.at(i);c++;}
  }
  cout<<c;
}
      

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

using namespace std;

int main(){
    string data;
    int k;
    cin >> data >> k;
    std::set<string> comb;
    for(int i = 0; i < data.size(); i++)
    {
        for(int j = 0; j <= k; j++){
            string part = data.substr(i, j);
            comb.insert(part);
        }
    }
    int index = 0;
    for(auto it = comb.begin(); it != comb.end(); ++it){
        if(index == k)
        {
	        cout << *it << endl;
        }
        index++;
    }
}

Measured memory_bytes: 1664
n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))
k = 10**9
x = 0
for i in range(n):
    if k > abs(a-(t - H[i]*0.006)):
        k = abs(a-(t - H[i]*0.006))
        x = i+1

print(x)



Measured memory_bytes: 3060