akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<30;

int main(void) {
    ll n, t;
    cin >> n >> t;
    vector<ll> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];

    vector<ll> v0;
    vector<PII> v1;
    REP(i, n) {
        if(a[i] == 0) v0.push_back(b[i]);
        else v1.emplace_back(a[i], b[i]);
    }

    sort(ALL(v1), [](PII l, PII r){
        return r.first * (l.second + 1) < l.first * (r.second + 1);
    });

    vector<vector<ll>> dp(v1.size()+1, vector<ll>(30, INF));
    dp[0][0] = 0;
    REP(i, v1.size()) REP(j, 30) {
        chmin(dp[i+1][j], dp[i][j]);
        if(j >= 1) chmin(dp[i+1][j], dp[i][j-1] + 1 + v1[i].first * (dp[i][j-1] + 1) + v1[i].second);
    }

    v0.push_back(0);
    sort(ALL(v0));
    FOR(i, 1, v0.size()) v0[i] += v0[i-1]+1;

    dump(dp[v1.size()]);
    dump(v0);

    ll ret = 0;
    REP(i, 30) {
        // dp[v1.size()][i] + v0[j] <= T である最大のj
        ll idx = upper_bound(ALL(v0), t - dp[v1.size()][i]) - v0.begin() - 1;
        dump(t-dp[v1.size()][i], idx);
        if(idx >= 0) chmax(ret, i + idx);
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 61164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

map<pair<VI,int>,ll> hs;
int n,h[110];
ll solve(VI x,int ty) {
	if (x.empty()) return 1;
	if (hs.count(mp(x,ty))) return hs[mp(x,ty)];
	int v=*min_element(all(x));
	if (ty==0) {
		ll ans=1;
		if (v==1) {
			VI c;
			for (auto p:x) {
				if (p==1) {
					ans=ans*2%mod;
					ans=ans*solve(c,0)%mod;
					c.clear();
				} else {
					c.pb(p);
				}
			}
			ans=ans*solve(c,0)%mod;
			return hs[mp(x,ty)]=ans;
		} else {
			VI y=x;
			rep(i,0,SZ(y)) y[i]-=v-1;
			ll all=solve(y,0);
			ll dif=solve(y,1)*2%mod;
			all=(all-dif+mod)%mod;
			return hs[mp(x,ty)]=(all+dif*powmod(2,v-1))%mod;
		}
	} else {
		// RBRB
		ll ans=1;
		if (v==1) {
			VI c;
			for (auto p:x) {
				if (p==1) {
					ans=ans*solve(c,1)%mod;
					c.clear();
				} else {
					c.pb(p);
				}
			}
			ans=ans*solve(c,1)%mod;
			return hs[mp(x,ty)]=ans;
		} else {
			VI y=x;
			rep(i,0,SZ(y)) y[i]-=v-1;
			ll dif=solve(y,1);
			return hs[mp(x,ty)]=dif*powmod(2,v-1)%mod;	
		}
	}
}

int main() {
	scanf("%d",&n);
	rep(i,0,n) scanf("%d",h+i);
	printf("%lld\n",solve(VI(h,h+n),0));
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 1020000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

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

int main(){
	int n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	ll gc = 0;
	rep(i,n) gc = GCD(gc,a[i]);
	vvl div(1000001);
	for(int i=2; i<=1000000; i++){
		if(div[i].size()) continue;
		for(int j=i; j<=1000000; j+=i){
			div[j].push_back(i);
		}
	}
	map<int,int> mp;
	rep(i,n){
		for(auto j : div[a[i]]){
			mp[j]++;
		}
	}
	int f = 0;
	for(auto i : mp){
		if(i.second >= 2){
			f++;
		}
	}
	if(gc == 1){
		if(f) puts("setwise coprime");
		else puts("pairwise coprime"); 
	}else{
		puts("not coprime");
	}
}

Measured memory_bytes: 84616
import heapq

N = int(input())
src = list(map(int,input().split()))

s1 = sum(src[:N])
r1 = [s1]
q1 = src[:N]
heapq.heapify(q1)
for i in range(N):
    heapq.heappush(q1,src[N+i])
    p = heapq.heappop(q1)
    r1.append(r1[-1] + src[N+i] - p)

s2 = -sum(src[-N:])
r2 = [s2]
q2 = [-a for a in src[-N:]]
heapq.heapify(q2)
for i in range(N):
    heapq.heappush(q2,-src[-N-i-1])
    p = heapq.heappop(q2)
    r2.append(r2[-1] - src[-N-i-1] - p)

ans = -float('inf')
for a,b in zip(r1,r2[::-1]):
    ans = max(ans, a+b)
print(ans)


Measured memory_bytes: 37212
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;


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

    ll k;
    cin >> k;

    queue<ll> q;
    for(ll i = 1; i < 10;i++){
        q.push(i);
    }
    ll x = 0;
    for(ll i = 0; i < k;i++){
        x = q.front();
        q.pop();
        if(x%10 != 0){
            q.push(x*10+(x%10)-1);
        }
        q.push(x*10+(x%10));
        if(x%10 != 9){
            q.push(x*10+(x%10)+1);
        }
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
using namespace std;
const char sp = ' ';
const long long N = 2e5 + 10;
const long long INF = 2e18;
long long n;
long long k, a[N], L, R;

int main() {
	cin >> n >> k;
	for (long long i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	L = -INF;
	R = INF;
	while (L + 1 != R) {
		long long Mid = (L + R) / 2;
		long long cnt = 0;
		for (long long i = 0; i < n; i++) {
			if (a[i] < 0) {
				long long l, r;
				l = i;
				r = n;
				while (l + 1 != r) {
					long long mid = (l + r) / 2;
					if (a[i] * a[mid] <= Mid) {
						r = mid;
					}
					else {
						l = mid;
					}
				}
				cnt += n - r;
			}
			else {
				long long l, r;
				l = i;
				r = n;
				while (l + 1 != r) {
					long long mid = (l + r) / 2;
					if (a[i] * a[mid] <= Mid) {
						l = mid;
					}
					else {
						r = mid;
					}
				}
				cnt += l - i;
			}
		}
		if (cnt < k)L = Mid;
		else R = Mid;
	}
	cout << R << endl;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

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

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
N,M,K=map(int,input().split())
s=[[]for i in range(N)]
tn=[0]*N
sys.setrecursionlimit(200000)
for i in range(M):
    a,b=map(int,input().split())
    s[a-1].append(b)
    s[b-1].append(a)
    tn[a-1]+=1
    tn[b-1]+=1
l=[None]*N
def hu(n,t):
    l[n]=t
    for i in s[n]:
        if l[i-1]==None:
            l[i-1]=t
            hu(i-1,t)
t=0
for i in range(N):
    if l[i]==None:
        hu(i,t)
        t+=1
c=[0]*t
for i in l:
    c[i]+=1
for i in range(K):
    a,b=map(int,input().split())
    if l[a-1]==l[b-1]:
        tn[a-1]+=1
        tn[b-1]+=1
for i in range(N):
    print(c[l[i]]-tn[i]-1,end=" ")

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

int main() {int i = 1;
	while(i <4){
		int H,M,S,h,m,s;
		cin >> H >> M >> S >> h >> m >> s;
		int k = 3600*(h-H)+60*(m-M)+s-S;
		int a = k/3600;
		k = k-3600*a;
		int b = k/60;
		k = k-60*b;
		cout << a <<" "<<b <<" "<<k <<endl;
		i++;
	}
	return 0;
}

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

using namespace std;

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

	vector<long long int> A(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	long long int ans = 1;
	long long int buf = 0;
	for (int i = 0; i < N - K; ++i)
	{
		if (A[i] < A[i + K]) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)

const LL mod=(1e9)+7;
int main()
{
    int n;
    map<string,int>mp;
    int mx=0;
    string s;
    vector<string>ans,v;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>s;
        mp[s]++;
        v.pb(s);
        mx=max(mx,mp[s]);
    }
    Unique(v);
    for(int i=0;i<v.size();i++)
    {
        if(mp[v[i]]==mx)
            ans.pb(v[i]);
    }
    sort(all(ans));
    for(int i=0;i<ans.size();i++)
        cout<<ans[i]<<"\n";
}


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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    ll x;
    cin >> x;
    cout << x/3600 << ":" << (x%3600)/60 << ":" << x%60 << endl;
    return 0;
}


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

using namespace std;

const int N = 200010;

int n, a[N];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= (i + 1);
    }
    sort(a, a + n);
    int b = a[n / 2];
    long long res = 0;
    for (int i = 0; i < n; i++) {
        res += abs(a[i] - b);
    }
    cout << res << '\n';
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define pii pair<ll,ll>
#define pll pair<long long, long long >
#define ll long long
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define maxn 1000000007
#define endl '\n'
#define trace(x) cerr << #x << ": " << x << endl;
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define MAX_N 50
const int LIM = 2e5+5, MOD = 1e9+7, EPS = 1e-9;
struct Matrix
{
  ll  mat[MAX_N][MAX_N];
};
Matrix matMul(Matrix a, Matrix b) {
	Matrix ans; int i, j, k;
	for (i = 0; i < MAX_N; i++)
	for (j = 0; j < MAX_N; j++)
	for (ans.mat[i][j] = k = 0; k < MAX_N; k++){
		ans.mat[i][j] += a.mat[i][k] * b.mat[k][j];
		ans.mat[i][j]%=MOD;
	}
	return ans;
}
Matrix matPow(Matrix base, ll p) {
	// O(n^3 log p)
	Matrix ans; int i, j;
	for (i = 0; i < MAX_N; i++) for (j = 0; j < MAX_N; j++)
	ans.mat[i][j] = (i == j); // prepare identity matrix
	while (p) {
		// iterative version of Divide & Conquer exponentiation
		if (p & 1) ans = matMul(ans, base);	// if p is odd (last bit is on)
		base = matMul(base, base);	// square the base
		p >>= 1;
		// divide p by 2
	}
	return ans;
}
ll add(ll x,ll y)
{
  if(x+y < maxn)return x+y;
  return (x+y)%maxn;
}
ll dir8[2][8] = {{1,-1,0,0,1,-1,1,-1},{0,0,1,-1,1,-1,-1,1}};
ll dir4[2][4] = {{1,-1,0,0},{0,0,1,-1}};
ll m,n,row,col,k;

void solve()
{
  cin >> n >> k;
  Matrix m;
  for(int w=0;w<n;w++)
  {
    for(int q=0;q<n;q++)cin>>m.mat[w][q];
  }
  Matrix p = matPow(m,k);
  ll ans = 0;
  for(int w=0;w<n;w++)
  {
    for(int q=0;q<n;q++)ans+=p.mat[w][q];
  }
  ans %= MOD;
  cout << ans << endl;
}
void test()
{
  ll t;
  //scanf("%d",&t);
  t = 1;
  for(ll test=1;test<=t;test++)
  {
    solve();
  }
}
int main()
{
  test();
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
const double EPS=1e-9;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
int main(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    int ans=INF;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(i==j)continue;
            for(int k=0;k<3;k++){
                if(i==k||j==k)continue;
                int c=abs(a[j]-a[i])+abs(a[k]-a[j]);
                ans=min(ans,c);
            }
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int num[5];
	int i, j;
	int rese;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &num[i]);
	}
	for (i = 0; i < 5; i++){
		for (j = 0; j< 5; j++){
			if (num[i] > num[j]){
				rese = num[i];
				num[i] = num[j];
				num[j] = rese;
			}
		}
	}
	
	for (i = 0; i < 5; i++){
		printf("%d", num[i]);
		if (i < 4){
			printf(" ");
		}
		else {
			printf("\n");
		}
	}
	
	return (0);
}

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

main(){

  int n;scanf("%d",&n);
  int a[n][n-1],b[n][n],vn=0;
  rep(i,n)rep(j,n-1){
    scanf("%d",&a[i][j]);
    a[i][j]--;
  }
  rep(i,n){
    for(int j=i;j<n;++j){
      b[i][j]=b[j][i]=vn;
      vn++;
    }
  }

  int deg[n*n];
  memset(deg,0,sizeof deg);
  vector<int> adj[n*n];
  set<int> use_v;
  rep(i,n){
    int prev_v=b[i][a[i][0]];
    use_v.insert(prev_v);
    for(int j=1;j<n-1;++j){
      int now_v=b[i][a[i][j]];
      use_v.insert(now_v);
      deg[now_v]++;
      adj[prev_v].push_back(now_v);
      prev_v=now_v;
    }
  }

  int sorted[n*n],sidx=0;
  memset(sorted,0,sizeof sorted);
  queue<int> que;
  for(const auto& i:use_v)if(deg[i]==0)que.push(i);
  while(!que.empty()){
    int now_v=que.front();
    que.pop();
    sorted[sidx]=now_v;
    sidx++;
    for(const auto& next_v:adj[now_v]){
      deg[next_v]--;
      if(deg[next_v]==0)que.push(next_v);
    }
  }

  if(sidx!=n*(n-1)/2){puts("-1");exit(0);}

  int cost[n*n],ans=0;
  memset(cost,0,sizeof cost);
  for(int i=sidx-1;i>=0;--i){
    int t=0,v=sorted[i];
    for(const auto& x:adj[v])t=max(t,cost[x]);
    cost[v]=t+1;
    ans=max(ans,cost[v]);
  }

  cout<<(ans)<<endl;


}

Measured memory_bytes: 82176
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d; cin >> a >> b >> c >> d;
    int bc = c / b + (c % b == 0? 0 : 1);
    int ad = a / d + (a % d == 0? 0 : 1);
    //cout << bc <<' ' << ad << endl;
    if(bc >= ad + 1) puts("No");
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 3592
S = input()
point = 0

if len(S)%2 == 0:
    for i in range(0,len(S),2):
        if S[i] in 'RUD' and S[i+1] in 'LUD':
            point += 2

if len(S)%2 == 1:
    if S[0] in 'RUD':
        point += 1
    for i in range(1,len(S),2):
        if S[i+1] in 'RUD' and S[i] in 'LUD':
            point += 2

if point == len(S):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9084
n = int(input())
li = list(map(int,input().split()))
ma = {}
for l in li:
    if l in ma:
        ma[l] += 1
    else:
        ma[l] = 1
all_sum = 0
for m in ma.values():
    if all_sum == 0 and m >= 2:
        all_sum = m*(m-1)//2
    elif m >= 2:
        all_sum = all_sum + m*(m-1)//2
for l in li:
    if ma[l] >=2:
        tmp_sum = all_sum - (ma[l]*(ma[l]-1)//2)
        if ma[l] >=3:
            tmp_sum += ((ma[l]-1)*(ma[l]-2)//2)
        print(tmp_sum)
    else:
        print(all_sum)

Measured memory_bytes: 25460
#include<iostream>
using namespace std;
int main(){
  int a[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
		cin>>a[i][j];
    }
  }
  int N;
  cin>>N;
  int x;
  while(N--){
    cin>>x;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
		if(a[i][j]==x){
          a[i][j]=0;
        }
      }
    }
  }
  int count=0;
  
  for(int i=0;i<3;i++){
    if(a[i][0]==0 && a[i][1]==0 && a[i][2]==0){
      cout<<"Yes"<<endl;
      break;
    }
    else if(a[0][i]==0 && a[1][i]==0 && a[2][i]==0){
      cout<<"Yes"<<endl;
      break;
    }
    else if(a[0][0]==0 && a[1][1]==0 && a[2][2]==0){
      cout<<"Yes" <<endl;
      break;
    }
    else if(a[0][2]==0 && a[1][1]==0 && a[2][0]==0){
      cout<<"Yes"<<endl;
      break;
    }
    else{
    	count++;
	}
  }
  if(count==3){
  	cout<<"No";
  }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  int h, w;
  while (std::cin >> h >> w) {
    if (h == 0 && w == 0) {
      return 0;
    }
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if (i == 0 || h == i+1 ||
            j == 0 || w == j+1) {
          std::cout << '#';
        }else{std::cout << '.';}
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }
}



Measured memory_bytes: 3040
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define random_shuffle asdasdd

int x, a, b;

int main() { 

  cin >> x >> a >> b;

  cout << (x - a) % b << endl;

  return 0;
}


Measured memory_bytes: 256
from sys import stdout

H, W = map(int, input().split())
a = [input() for _ in range(H)]

h = [all(c == '.' for c in a[i]) for i in range(H)]

w = [True] * W
for i in range(H):
  for j in range(W):
    w[j] = w[j] and a[i][j] == '.'

for i in range(H):
  if h[i]:
    continue
  for j in range(W):
    if w[j]:
      continue
    stdout.write(a[i][j])
  stdout.write('\n')


Measured memory_bytes: 3700
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include <assert.h>

int main(void){
		long long int a,b = 100,c = 0;
    //int ans;
		scanf("%lld",&a);

    while(1){
    b = b*1.01;
    c++;
    if(b >= a){
      break;
    }
  }
  printf("%lld\n",c);


		return 0;
}


Measured memory_bytes: 1736
n = int(input())
S = [int(input()) for i in range(n)]
S.sort()

def c():
    su = sum(S)
    if su % 10 > 0:
        return su
    else:
        for i in range(n):
            if S[i] % 10 > 0:
                return su-S[i]
        return 0

print(c())

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
using namespace std;
const int mod = 1e9 + 7;
int n, a[200010], b[200010];
int f[4010][4010];
int jc[8010], ny[8010];
inline int C (int n, int m) { return 1ll * jc[n] * ny[m] % mod * ny[n - m] % mod; }
int main () {
	scanf ("%d", &n);
	jc[0] = 1; for (int i = 1; i <= 8000; i++) jc[i] = 1ll * jc[i - 1] * i % mod;
	ny[0] = ny[1] = 1; for (int i = 2; i <= 8000; i++) ny[i] = 1ll * (mod - mod / i) * ny[mod % i] % mod;
	for (int i = 1; i <= 8000; i++) ny[i] = 1ll * ny[i - 1] * ny[i] % mod;
	for (int i = 1; i <= n; i++) {
		scanf ("%d%d", &a[i], &b[i]);
		f[2000 - a[i]][2000 - b[i]]++;
	}
	for (int i = 1; i <= 4000; i++) f[0][i] += f[0][i - 1], f[i][0] += f[i - 1][0];
	for (int i = 1; i <= 4000; i++)
		for (int j = 1; j <= 4000; j++)
			f[i][j] = (f[i][j] + f[i - 1][j] + f[i][j - 1]) % mod;
	int ans = 0;
	for (int i = 1; i <= n; i++) ans = (ans + f[2000 + a[i]][2000 + b[i]]) % mod;
	for (int i = 1; i <= n; i++) {
		int x = C ((a[i] + b[i]) * 2, a[i] * 2);
		ans = (ans - x + mod) % mod;
	}
	printf ("%lld\n", 1ll * ans * ny[2] % mod);
	return 0;
}

Measured memory_bytes: 64640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define repd(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    int ans = 0;
    rep2(i, 1, N + 1)
    {
        int div = 0;
        if (i % 2 == 1)
        {

            rep2(j, 1, N + 1)
            {
                if (i % j == 0)
                {
                    div++;
                }
            }
        }
        if (div == 8)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
#define enl << endl
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    ll n;
    cin >> n;

    ll res = 1;
    reps(i, 1, sqrt(n)){
        if(n%i == 0){
            res = i;
        }
    }

    ll r = res-1 + n/res-1;
    cout << r << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func check(n int) bool {
	for cake_price := 0; cake_price <= 100; cake_price += 4 {
		for doughnut_price := 0; doughnut_price+cake_price <= 100; doughnut_price += 7 {
			if cake_price+doughnut_price == n {
				return true
			}
		}
	}
	return false
}

func main() {
	var n int
	fmt.Scan(&n)
	if check(n) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto xyh = new long[][](N, 3);
	foreach (i; 0..N)
	{
		xyh[i] = [RD, RD, RD];
	}
	xyh.sort!"a[2] > b[2]"();

	long[3] ans;
	(){
	foreach (y; 0..101)
	{
		foreach (x; 0..101)
		{
			bool ok = true;
			auto h = -(-abs(x-xyh[0][0]) - abs(y-xyh[0][1]) - xyh[0][2]);
			debug if (x == 100 && y == 0) writeln(h);
			foreach (i; 0..N)
			{
				if (max(h - abs(x-xyh[i][0]) - abs(y-xyh[i][1]), 0) != xyh[i][2])
				{
					ok = false;
					break;
				}
			}
			if (ok)
			{
				ans = [x, y, h];
				return;
			}
		}
	}}();

	writeln(ans[0], " ", ans[1], " ", ans[2]);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
n=int(input())
for i in range(1,n+1):
    if i%3==0:
        print(' {0}'.format(i),end='')
    else:
        x=i
        while x>0:
            if x%10==3:
                print(' {0}'.format(i),end='')
                break
            else:
                x=x//10
print('')


Measured memory_bytes: 5872
n=int(input())
b=list(map(int,input().split()))
l=[]
while len(b)>0:
    for i in reversed(range(len(b))):
        flag=False
        if b[i]==i+1:
            l.append(i+1)
            del b[i]
            flag=True
            break
        else:
            pass
    if flag:
        continue
    else:
        break

if flag:
    for i in range(len(l)):
        print(l[len(l)-i-1])
else:
    print(-1)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
const int MOD=1e9+7;
#define pb push_back
#define cy cout<<"Yes\n"
#define cn cout<<"No\n"
#define ci cout<<"impossible\n"
typedef unsigned long long int ull;
typedef long long int ll;

ll a[500005];
const int M=1e4;
ll cnt[M];
int main()
{
    string s,t;
    cin>>s>>t;
    int n=s.size(),m=t.size();
    int cnt=0,mx=1000000;
    for(int i=0;i<n-m+1;i++)
    {
        cnt=0;
        for(int j=0;j<m;j++)
        {
            if(s[i+j]!=t[j])
                cnt++;

        }
        mx=min(mx,cnt);
    }
    cout<<mx<<endl;
}




Measured memory_bytes: 3608
function Dice( faces ) {
  this.faces = faces;
  this.getFace = function ( id ) {
    return this.faces[id];
  }
  this.roll = function ( cmds ) {
    var t;
    for( var i=0; i<cmds.length; i++ ) {
      if( 'E' == cmds[i] ) {
        t = this.faces[Dice.TOP];
        this.faces[Dice.TOP] = this.faces[Dice.LEFT];
        this.faces[Dice.LEFT] = this.faces[Dice.BOTTOM];
        this.faces[Dice.BOTTOM] = this.faces[Dice.RIGHT];
        this.faces[Dice.RIGHT] = t;
      } else if( 'S' == cmds[i] ) {
        t = this.faces[Dice.TOP];
        this.faces[Dice.TOP] = this.faces[Dice.BACK];
        this.faces[Dice.BACK] = this.faces[Dice.BOTTOM];
        this.faces[Dice.BOTTOM] = this.faces[Dice.FRONT];
        this.faces[Dice.FRONT] = t;
      } else if( 'W' == cmds[i] ) {
        t = this.faces[Dice.TOP];
        this.faces[Dice.TOP] = this.faces[Dice.RIGHT];
        this.faces[Dice.RIGHT] = this.faces[Dice.BOTTOM];
        this.faces[Dice.BOTTOM] = this.faces[Dice.LEFT];
        this.faces[Dice.LEFT] = t;
      } else if( 'N' == cmds[i] ) {
        t = this.faces[Dice.TOP];
        this.faces[Dice.TOP] = this.faces[Dice.FRONT];
        this.faces[Dice.FRONT] = this.faces[Dice.BOTTOM];
        this.faces[Dice.BOTTOM] = this.faces[Dice.BACK];
        this.faces[Dice.BACK] = t;        
      } else if( 'M' == cmds[i] ) {
        t = this.faces[Dice.FRONT];
        this.faces[Dice.FRONT] = this.faces[Dice.RIGHT];
        this.faces[Dice.RIGHT] = this.faces[Dice.BACK];
        this.faces[Dice.BACK] = this.faces[Dice.LEFT];
        this.faces[Dice.LEFT] = t;        
      }
    }
  }
  this.isEqual = function( other ) {
    var i;
    for( i=Dice.TOP; i<=Dice.BOTTOM; i++ ) {
      if( this.getFace( i ) != other.getFace( i ) ) { break; }
    }
    return  (i==6)?true:false;
  }
}
Dice.TOP = 0;
Dice.FRONT = 1;
Dice.RIGHT = 2;
Dice.LEFT = 3;
Dice.BACK = 4;
Dice.BOTTOM = 5;
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var data = input.split( '\n' );
  var labels = data[0].split( ' ' ).map( Number );
  var dice = new Dice( labels ); 
  var labels2 = data[1].split( ' ' ).map( Number );
  var dice2 = new Dice( labels2 ); 

  var cmds = "NWWWNMMMM";
  var isequal = false;
  for( var i=0; i<7 && !isequal; i++ ) {
    if( dice2.getFace( Dice.TOP ) == dice.getFace( Dice.TOP ) ) {
      var j;
      for( j=5; j<cmds.length && !isequal; j++ ) {
        if( dice2.getFace( Dice.FRONT ) == dice.getFace( Dice.FRONT ) ) { 
          isequal = dice.isEqual( dice2 );
        }
        dice2.roll( cmds[j] );
      }
    }
    dice2.roll( cmds[i] );
  }
  if( isequal) {
    console.log( "Yes" );
  } else {
    console.log( "No" );
  }
});

Measured memory_bytes: 15672
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<Long> one = nextLongArray();
      long A = one.get(0);
      long B = one.get(1);
      long C = one.get(2);
      if(A + B >= C){
        myout(B + C);
      }else{
        myout(A + B * 2 + 1);
      }
	}
	//Method addition frame start



	//Method addition frame end
}


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

int main() {
    int n, h, p, ans=0, temp=0;
    cin >> n;
    rep(i,n) {
        p = h;
        cin >> h;
        if(p < h) {
            ans = max(temp, ans);
            temp=0;
        }
      	else{
            temp++;
        }
            ans = max(ans,temp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
signed main()
{
  int n;
  cin>>n;
  vector<int>dp(3);
  for(int day=0;day<n;day++)
  {
      vector<int>new_dp(3,0);
      vector<int>c(3);
      for(int i=0;i<3;i++)
      cin>>c[i];
      for(int i=0;i<3;i++)
      {
          for(int j=0;j<3;j++)
          {
              if(i!=j)
              {
                  new_dp[j]=max(new_dp[j],dp[i]+c[j]);
              }
          }
      }
      dp=new_dp;
  }
  cout<<max(dp[0],max(dp[1],dp[2]))<<endl;
}

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<string> S(N);

	for (auto& x : S) {
		cin >> x;
	}
	sort(S.begin(), S.end());
	S.erase(unique(S.begin(), S.end()), S.end());

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


Measured memory_bytes: 9544
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
typedef long long ll; 
char str[300005]; 
int pre[300005]; 
int main()
{
	// freopen("ARC098-C.in", "r", stdin); 
	int n, cur = 0, ans = 1e9; 
	scanf("%d%s", &n, str); 
	for (int i = 0; i < n; i++)
		pre[i] = (i ? pre[i - 1] : 0) + (str[i] == 'W'); 
	for (int i = n - 1; i >= 0; i--)
	{
		ans = std::min(ans, cur + (i ? pre[i - 1] : 0)); 
		cur += str[i] == 'E'; 
	}
	printf("%d\n", ans);
	return 0; 
}


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n,q; cin >> n >> q;
    vl a(n+1), s(n+1), ss(n+1);
    rep(i,n) cin >> a[i+1];
    rep(i,n){
        s[i+1] = s[i] + a[i+1];
        ss[i+1] = a[i+1];
        if(i-1 > 0) ss[i+1] += ss[i-1];
    }

    rep(i,q){
        int x; cin >> x;
        int l = 0, r = n;
        while(r-l > 1){
            int m = (l+r) / 2;
            if(a[m] < x){
                l = m;
            }else{
                int upper = n - m + 1;
                int lower = m - (lower_bound(all(a), max(1ll, 2*x-a[m])) - a.begin()) + 1;
                if(upper > lower) l = m;
                else r = m;
            }
        }
        ll ans = s[n] - s[r-1];
        int idx = n - (n-r+1)*2;
        if(idx > 0) ans += ss[idx];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5640
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
int (*rd)()=read<int>;
//const u32 P=;
//inline u32 &inc(u32 &a, u32 b) {return (a+=b)<P?a:(a-=P);}
//inline u32 &dec(u32 &a, u32 b) {return (a-=b)&0x80000000?(a+=P):a;}
//inline u32 sum(u32 a, u32 b) {return (a+=b)<P?a:a-P;}
//inline u32 dif(u32 a, u32 b) {return (a-=b)&0x80000000?a+P:a;}
//u64 power(u64 a, int b) {
//	u64 ans=1;
//	for(; b; a=a*a%P, b/=2) if(b&1) ans=ans*a%P;
//	return ans;
//}

const int N=2e5+1;
char s[N];
int main() {
	scanf("%s", s);
	for(int i=0; s[i]; ++i) if(s[i]=='?') s[i]='D';
	puts(s);
	return 0;
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll f(ll a, ll b){
	if(a == b) return a;
	if(a < b){
		long long take = (b - 1) / a;
		return 2 * a * take + f(b - take * a, a);
	} else {
		long long take = (a  - 1) / b;
		return 2 * b * take + f(a - take * b, b);
	}
}
int main(){
	long long n, x; cin >> n >> x;
	cout << f(x, n - x) + n << endl;
	return 0;
}


Measured memory_bytes: 256
import math

n = int(input())
x = list(map(float, input().split(' ')))
y = list(map(float, input().split(' ')))

for p in range(1, 4):
    ans = 0
    for i in range(n):
        ans += math.pow(abs(x[i] - y[i]), p)
    ans = math.pow(ans, 1 / p)
    print(ans)

ans = 0
for i in range(n):
    ans = max(ans, abs(x[i] - y[i]))
print(ans)



Measured memory_bytes: 5720
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    double n;cin >> n;
    cout << fixed << setprecision(4) << 2*3.141592*n << endl;
}
// ll n;cin >> n;
// vector<int> a(n);
// rep(i,n) cin >> a[i];

// cout << (res?"Yes":"No") << endl;
// cout << ans << endl;

Measured memory_bytes: 3780
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

string S,T;

vector<string> result;

signed main(){
    cin>>S>>T;

    for(int i=0;i<S.size()-T.size()+1;++i){
        string tmp=S;
        bool formable=true;
        for(int j=0;j<T.size();++j){
            if(S[i+j]==T[j]||S[i+j]=='?')continue;
            formable=false;
        }
        if(!formable)continue;
        for(int j=0;j<T.size();++j)tmp[i+j]=T[j];
        for(int j=0;j<tmp.size();++j)if(tmp[j]=='?')tmp[j]='a';
        result.push_back(tmp);
    }

    sort(result.begin(),result.end());
    if(!result.size())cout<<"UNRESTORABLE"<<endl;
    else cout<<result.front()<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
typedef long long ll;
using namespace std;

int main(void){
    ll n,m,ans=1;cin>>n>>m;
    if(m%n==0){cout<<m/n<<endl;return 0;}
    for(ll i=1;i*i<=m;i++){
        if(m%i==0){
            if(m/i>=n)ans=max(ans,i);
            if(i>=n)ans=max(ans,m/i);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import itertools
from collections import Counter

N = int(input())
S = input()

C=Counter(S)
r = C['R']
g = C['G']
b = C['B']


cnt = r * g * b

for i in range(0,N-2):
    for j in range(i,N-1):
        k = j + j - i
        if k < N:
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                cnt -= 1

print(cnt)


Measured memory_bytes: 9492
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef complex <double> cp;
#define debug(a) cout<<#a<<":"<<a<<endl;
#define fr freopen("in.txt","r",stdin);
#define Fill(x,a) memset(x,a,sizeof(x))
#define cpy(a,b) memcpy(a,b,sizeof(a))
const double PI = acos(-1);
const int INF=0x3f3f3f3f;
const int N=1e6+7;
const int mod=1e9+7;
int maxn,minn;
int T,n,m,q;
int d,t,v;

int main(){
	cin >> d >> t >> v;
	if(t * v >= d){
		puts("Yes");
	}
	else{
		puts("No");
	}
	


	return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
const int INF = INT_MAX;

int main(){
    string s;
    cin >> s;
    for(int i=0; i<26; i++){
        for(int j=0; j<s.length(); j++){
            if('a'+i == s[j]){
                break;
            }
            if(j==s.length()-1){
                cout << char('a'+i) << endl;
                return 0;
            }
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
def J(string):
    return string[-1] + string[:-1] if len(string) >= 2 else string
     
def C(string):
    return string[1:] + string[0] if len(string) >= 2 else string

def E(string):
    if len(string) == 1:
        return string
        
    if len(string) % 2:
        return string[len(string) // 2 + 1:] + string[len(string) // 2] + string[0:len(string) // 2]
    else:
        return string[len(string) // 2:] + string[0:len(string) // 2]

def A(string):
    return string[::-1]

def M(string):
    new = ''
    for i in string:
        if ord(i) < 57 and ord(i) >= 48:
            new += chr(ord(i) + 1)
        elif ord(i) == 57:
            new += '0'
        else:
            new += i
    return new

def P(string):
    new = ''
    for i in string:
        if ord(i) <= 57 and ord(i) > 48:
            new += chr(ord(i) - 1)
        elif ord(i) == 48:
            new += '9'
        else:
            new += i
    return new


ans = []
for i in range(int(input())):
    to_do = input()
    message = input().strip()
    
    for i in to_do[::-1]:
        if i == 'C':
            message = C(message)
        if i == 'J':
            message = J(message)
        if i == 'E':
            message = E(message)
        if i == 'A':
            message = A(message)
        if i == 'P':
            message = P(message)
        if i == 'M':
            message = M(message)
    ans.append(message)

[print(i) for i in ans]
    


Measured memory_bytes: 5604
a,b=map(int,input().split())
h,w=100,100
la=[]
for i in range(a-1):
    if i==0:
        x,y=0,-2
    else:
        x,y=la[-1]
    y+=2
    if y>=w:
        x+=2
        y=0
    la.append((x,y))
la=set(la)
lb=[]
for i in range(b-1):
    if i==0:
        x,y=51,-2
    else:
        x,y=lb[-1]
    y+=2
    if y>=w:
        x+=2
        y=0
    lb.append((x,y))
lb=set(lb)

ans=[]
print(h,w)
for i in range(100):
    tmp=""
    for j in range(100):
        if (i,j) in la:
            tmp+="."
        elif (i,j) in lb:
            tmp+="#"
        elif i<50:
            tmp+="#"
        else:
            tmp+="."
    print(tmp)







Measured memory_bytes: 3188
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
    double a, b, c, s, l, h, theta;
    const double pi = 3.1415926535897;
    cin >> a >> b >> c;
    theta = (c * pi) / (double)(180);
    s = a * b * sin(theta) / (double)(2);
    l = a + b + sqrt( a * a + b * b - 2 * a * b * cos(theta));
    h = 2 * s / a;
    printf("%.8f\n", s);
    printf("%.8f\n", l);
    printf("%.8f\n", h);
    return 0;
}



Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

ll dp[60][6000];

int main()
{
  int n, a;
  cin >> n >> a;
  vector<int> x(n);
  for (int i = 0; i < n; ++i)
  {
    cin >> x[i];
    x[i] -= a;
  }
  sort(x.begin(), x.end());
  dp[0][3000] = 1;
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j <= 6000; ++j)
    {
      if (j - x[i] >= 0)
        dp[i + 1][j] = dp[i][j] + dp[i][j - x[i]];
      else
        dp[i + 1][j] = dp[i][j];
    }
  }
  cout << dp[n][3000] - 1 << endl;

  return 0;
}

Measured memory_bytes: 2560