akhauriyash/Code-Regression huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = []
    H, W = LI()
    for i in range(H):
        _s = S()
        s.append(_s)
    for r in range(H):
        for c in range(W):
            if s[r][c] == '.':
                continue
            any_tonari_black = False
            for dr, dc in zip(DR, DC):
                new_r = r + dr
                new_c = c + dc
                if not (0 <= new_r < H and 0 <= new_c < W):
                    continue
                if s[new_r][new_c] == '#':
                    any_tonari_black = True
            if not any_tonari_black:
                print('No')
                return
    print('Yes')
main()



Measured memory_bytes: 6732
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int f=0;
	for(int i=0;i<=25;i++) {
		for(int j=0;j<=15;j++) {
			if((i*4+j*7)==n) {
				f=1;
				break;
			}
		}
		if(f) break;
	}
	if(f) 
		cout<<"Yes"<<endl;
	else
	 	cout<<"No"<<endl;	
	return 0;
}


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

int main() {

	int n; cin >> n;
	vector<ll> z(n), w(n);
	for (int i = 0; i < n; i++) {
		int x, y; cin >> x >> y;
		z[i] = x + y;
		w[i] = x - y;
	}
	ll a = *max_element(z.begin(), z.end());
	ll b = *min_element(z.begin(), z.end());
	ll c = *max_element(w.begin(), w.end());
	ll d = *min_element(w.begin(), w.end());
	cout << max(a - b, c - d) << endl;
	return 0;
}

Measured memory_bytes: 6400
s = list(input())
a = 0
b = 0
c = 0
for i in range(len(s)):
         if s[i] == "a":
                  a += 1
         elif s[i] == "b":
                  b += 1
         else:
                  c += 1
if (len(s)+2)//3 < max(a,b,c):
         print("NO")
else:
         print("YES")


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
    int n;
    cin>>n;
    vector<int> l(n*2);
    for(int i=0;i<n*2;i++){
        cin>>l[i];
    }
    sort(rall(l));
    ll ans=0;
    for(int i=0;i<n;i++){
        ans+=l.at(i*2+1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define iter(it,a) for(auto it=a.begin();it!=a.end();it++)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define preturn(X) cout<<X<<endl; return 0
typedef long long ll;
 
 
vector<pair<pair<ll,ll>,ll> > edges;
ll n,m;
ll val[2001];
bool vis[2001];
vector<int> adj[1001];
bool reach[2001];
bool dfs(int x){
	vis[x] = 1;
	if(x==n){
		return 1;
	}
	iter(it,adj[x]){
		if(!vis[(*it)]){
			if(dfs((*it))==1){
				return 1;
			}
		}
	}
	return 0;
}
 
int main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    cin>>n>>m;
    rep(i,1,n+1){
        val[i] = 1e16;
    }
    ll u,v,c;
    rep(i,0,m){
        cin>>u>>v>>c;
        adj[u].pb(v);
        edges.pb(mp(mp(u,v),ll(-1)*c));
    }
    rep(i,1,n+1){
    	if(i==n){
    		reach[i] = 1;
    	}
    	memset(vis,0,sizeof(vis));
    	reach[i] = dfs(i);
    }
    val[1]=0;
    rep(i,0,n){
        if(i==n-1){
            rep(j,0,edges.size()){
            	if(val[edges[j].F.F]==1e16){
            		continue;
            	}
                if(val[edges[j].F.S]  > val[edges[j].F.F]+edges[j].S && reach[edges[j].F.S]){
                    preturn("inf");
                }
            }
        }
        else{
            rep(j,0,edges.size()){
            	if(val[edges[j].F.F]==1e16){
            		continue;
            	}
                val[edges[j].F.S] = min(val[edges[j].F.S],val[edges[j].F.F]+edges[j].S);
            }
        }
    }
    preturn(ll(-1)*val[n]);
}

Measured memory_bytes: 384
#include <stdio.h>
int main(){
 int n,i,j,temp,count,num[100];
 
 scanf("%d",&n);
 for(i = 0;i < n;i++) scanf("%d",&num[i]);
 count=0;

 for(i = 0;i < n-1;i++){
  for(j = n-1; j > 0; j--){
   if(num[j]<num[j-1]){
    temp = num[j];
    num[j] = num[j-1];
    num[j-1] = temp;
    count++;
 }
 }
 }
 
 for(i = 0;i < n-1;i++){
 printf("%d ",num[i]);
 }
 printf("%d",num[n-1]);
 printf("\n%d\n",count);
 
 return 0;
}

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

N = INT()

ans = ""
while 0 < N:
	N -= 1
	ans += ascii_lowercase[N%26]
	N //= 26

print(ans[::-1])

Measured memory_bytes: 10036
#include <bits/stdc++.h>
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n>> m;
    vector<string> a(n),b(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        cin >> b[i];
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(a[i][j]!=b[i][j]){
                ans++;
                // cout << i << ' ' << j << endl;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 11396
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
#define ll long long

int main(){
    string S;
    cin >> S;
    ll i;
    ll cnt1=0,cnt2=0;
    for(i=0;i<S.size();i++){
        if(i%2==0){if(S[i]=='0')cnt1++;else cnt2++;}
        if(i%2==1){if(S[i]=='1')cnt1++;else cnt2++;}
    }
    cout << min(cnt1,cnt2)<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef unsigned long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
    cin>>N>>K;
    N += 2*K;
    N /= 2*K + 1;
    cout<<N<<endl;
}


Measured memory_bytes: 256
Sp = input()
T = input()
NSp = len(Sp)
NT = len(T)

for i in range(NSp-NT+1):
  Snow = Sp[NSp-NT-i:NSp-i]
  for j in range(NT):
    if (Snow[j]=='?') or (Snow[j]==T[j]):
      continue
    else:
      break
  else:
    ans = ''
    for k in range(NSp):
      if (NSp-NT-i<=k) and (k<=NSp-i-1):
        ans += T[k-NSp+NT+i]
      else:
        if Sp[k] == '?':
          ans += 'a'
        else:
          ans += Sp[k]
    print(ans)
    break
else:
  print('UNRESTORABLE')

Measured memory_bytes: 3064
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

ll gcd(ll a, ll b) {
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    ll a, b; cin >> a >> b;
    ll g = gcd(a, b);
    ll res = 1;

    ll mx = (ll) sqrt(g);
    FOR(i, 2, mx) {
        bool f = false;
        while (g % i == 0) {
            g /= i;
            f = true;
        }
        if (f) {
            res += 1;
        }
    }
    if (g != 1) {
        res += 1;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) cerr << #v << ":"; rep(i, v.size()) cerr << " " << v[i]; cerr << endl
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    ll ans = 1;
    int n;
    cin >> n;
    vector<ll> A(n);
    rep(i, n) {
        cin >> A[i];
    }
    sort(all(A));
    if (A[0] == 0) {
        cout << 0 << endl;
        return;
    }
    rep(i, n) {
        if (ans > (ll)1e18 / A[i]) {
            cout << -1 << endl;
            return;
        } else {
            ans *= A[i];
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 3992
N,S = map(int,input().split())
A = list(map(int,input().split()))
dp = [[0 for j in range(S+2)] for i in range(N+1)]
dp[0][0] = 1
mod = 998244353
for i,a in enumerate(A):
    for j in range(S+1):
        if j-a >= 0:
            dp[i+1][j] = (dp[i][j]*2+dp[i][j-a])%mod
        else:
            dp[i+1][j] = dp[i][j]*2%mod

print(dp[N][S])


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

int main() {
  int N;
  cin>>N;
  vector<int> d(N);
  for(int i=0; i<N; i++){
    cin>>d.at(i);
  }
  int sum = 0;
  
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(i<j){
        sum = sum+d.at(i)*d.at(j);
      }
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 3592
def do_left(s, v, idx):
  while idx > 0 and s[idx] == '>':
    v[idx - 1] = max(v[idx] + 1, v[idx - 1])
    idx -= 1

def do_right(s, v, idx):
  while idx < len(v) - 1 and s[idx + 1] == '<':
    v[idx + 1] = max(v[idx] + 1, v[idx + 1])
    idx += 1
    
def main():
  s = '>' + input().strip() + '<'
  v = [-1] * (len(s) - 1)
  
  for i, (b, a) in enumerate(zip(s[:-1], s[1:])):
    if b == '>' and a == '<':
      v[i] = 0
      do_left(s, v, i)
      do_right(s, v, i)

  #print(v)
  print(sum(v))
  
if __name__ == '__main__':
  main()


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

int MAX = 1000000;
int MOD = 1000000007;

vector<long long> fac(MAX), finv(MAX), inv(MAX);
void COMinit() {
  fac.at(0) = fac.at(1) = 1;
  finv.at(0) = finv.at(1) = 1;
  inv.at(1) = 1;
  for (int i = 2; i < MAX; i++) {
    fac.at(i) = fac.at(i-1) * i % MOD;
    inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i-1) * inv.at(i) % MOD;
  }
}

long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac.at(n) * (finv.at(k) * finv.at(n-k) % MOD) % MOD;
}

int main() {
  int X, Y; cin >> X >> Y;
  int n = (X + Y) / 3;
  int r = X - n;
  if ((X + Y) % 3 != 0 || r < 0) {
    cout << 0 << endl;
    return 0;
  }
  COMinit();
  cout << COM(n, r) << endl;
}

Measured memory_bytes: 23680
#include <cstdio>
        #include <cstdlib>
         
        int N, M;
        int L[200010], R[200010], D[200010];
        int fa[100010], V[100010];
        int T[100010];
        int MN[100010], MX[100010];
         
        int getFa(int u)
        {
        	int u2=u;
        	int d=0;
        	T[u] = d;
        	while(fa[u]!=-1){
        		d += V[u];
        		u = fa[u];
        		T[u] = d;
        	}
        	V[u2] = T[u];
        	while(fa[u2]!=-1){
        		int u3=fa[u2];
        		fa[u2] = u;
        		u2 = u3;
        		V[u2] = T[u]-T[u2];
        	}
        	return u;
        }
         
        int solve()
        {
        	int i;
        	for(i=0; i<N; i++){
        		fa[i] = -1;
        	}
        	int u1, u2;
        	for(i=0; i<M; i++){
        		u1 = getFa(L[i]);
        		u2 = getFa(R[i]);
        		if(u1!=u2){
        			fa[u2] = u1;
        			//V[u2] = V[L[i]] + D[i];
        			V[u2] = D[i] - V[R[i]] + V[L[i]];
        		}
        		else{
        			if(V[R[i]]-V[L[i]] != D[i])
        				return 0;
        		}
        	}
        	/*for(i=0; i<N; i++){
        		u1 = getFa(i);
        	}
        	for(i=0; i<N; i++){
        		if(fa[i]!=-1){
        			u1 = fa[i];
        			if(V[i]<MN[u1])
        				MN[u1] = V[i];
        			if(V[i]>MX[u1])
        				MX[u1] = V[i];
        		}
        	}
        	for(i=0; i<N: i++){
        		if(fa[i]==-1){
        			if(MX[i]-MN[i]>1000000000)
        				return 0;
        		}
        	}*/
        	return 1;
        }
         
        int x[100010];
        void test()
        {
        	int i;
        	N = 4;
        	M = 8;
        	/*for(i=0; i<N-1; i++){
        		L[i]=i+1;
        		R[i]=i;
        		D[i]=10000;
        	}*/
        	for(i=0; i<N; i++)
        		x[i] = rand();
        	for(i=0; i<M; i++){
        		L[i] = rand() % N;
        		R[i] = rand() % N;
        		if(L[i]==R[i])
        			R[i] ++;
        		D[i] = x[R[i]]-x[L[i]];
        	}
        	if(solve() )
        		printf("Yes\n");
        	else
        		printf("No\n");
        }
         
        int main()
        {
        	//test();
        	//freopen("in.txt", "r", stdin);
        	int i;
        	scanf("%d%d", &N, &M);
        	for(i=0; i<M; i++){
        		scanf("%d%d%d", &L[i], &R[i], &D[i]);
        		L[i]--, R[i]--;
        	}
        	if(solve() )
        		printf("Yes\n");
        	else
        		printf("No\n");
        	return 0;
        }

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    int x = 0;
    int l = 0;
    int r = 0;
    REP(i, N) {
        if(s[i] == '(') {
            l++;
        }else{
            r++;
        }
        x = min(l - r, x);
    }
    int ds = l - r;
    REP(i, -x) {
        cout << '(';
    }
    cout << s;
    REP(i, ds - x) {
        cout << ')';
    }
    cout << endl;
    return 0;
}


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

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

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

const int BS = 310;
int dp[110][BS][BS * 3];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> a(n), b(n), c(n), d(n);
    REP(i, 0, n) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    REP(i, 0, 110) {
        REP(j, 0, BS) {
            REP(k, 0, BS * 3) {
                dp[i][j][k] = -1;
            }
        }
    }

    dp[0][x][y + BS] = 0;

    REP(i, 0, n) {
        REP(j, 0, BS) {
            REP(k, 0, BS * 3) {
                if (dp[i][j][k] == -1) continue;
                if (j >= a[i] && k + b[i] < BS * 3) {
                    chmax(dp[i + 1][j - a[i]][k + b[i]], dp[i][j][k]);
                }
                if (k >= c[i]) {
                    chmax(dp[i + 1][j][k - c[i]], dp[i][j][k] + d[i]);
                }
                chmax(dp[i + 1][j][k], dp[i][j][k]);
            }
        }
    }
    int ans = 0;
    REP(i, 0, BS) {
        REP(j, BS, BS * 3) {
            chmax(ans, dp[n][i][j]);
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 127092
// Problem : B - Multiple of 9
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
const long long int  modu=1e9+7;
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define inp(x)  for(auto &t:x) cin>>t;
#define itr     vector<int>::iterator
#define debug(a) cout << #a << "=" << a << ' '<<endl;
#define out(x)  for(auto &t:x) cout<<t<<" "; cout<<endl;
#define ff first
#define ss second
#define pb push_back
#define initialize(a,v)  for(int i=0;i<a.size();++i) a[i]=v;
#define all(x) x.begin(),x.end()
#define mpt(mp) for(auto it=mp.begin();it!=mp.end();it++)
#define trav(x) for(int i=0;i<(int)x.size();++i)
#define mkp(a,b) make_pair(a,b)
#define sz(x)  (int)x.size()

int noofdig(int N)
{
	return floor(log10(N))+1;
}


ll f(ll a)
{

return 0;

}



void pre()
{

}



void solve()
{
	string s;
	cin>>s;
	
    ll sum=0;
   
   for(auto x:s)
   sum+=(x-'0');


   if(sum%9==0) cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;
    



}



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

	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3796
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N, x;
    cin >> N >> x;

    if (N == 2) {
        if (x == 2) {
            cout << "Yes\n1\n2\n3\n";
        } else {
            cout << "No\n";
        }
        return 0;
    }

    if (x == 1 || x == 2*N-1) {
        cout << "No\n";
        return 0;
    }

    vec ans(2*N-1, -1);
    if (x == 2) {
        ans[N-3] = 3;
        ans[N-2] = 1;
        ans[N-1] = 2;
        ans[N] = 4;
        ll tmp = 5;
        Rep (i, 2*N-1) {
            if (N-3 <= i && i <= N) continue;
            if (ans[i] == -1) {
                ans[i] = tmp++;
            }
        }
    } else {
        ans[N-3] = x-2;
        ans[N-2] = x+1;
        ans[N-1] = x;
        ans[N] = x-1;
        ll tmp = 1;
        Rep (i, 2*N-1) {
            if (N-3 <= i && i <= N) continue;
            if (x-2 <= tmp && tmp <= x-1) tmp = x+2;
            ans[i] = tmp;
            tmp++;
        }
    }

    cout << "Yes\n";
    Rep (i, 2*N-1) {
        cout << ans[i] << "\n";
    }
}

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




int main() {


        string s , t ;
         cin >> s >> t;
                int cnt = 0;
          for ( int i = 0 ; i < s.length() ; i++){
                if (s[i]!=t[i])
                    cnt ++ ;
          }
          cout << cnt << endl;
            
        return 0;
    }

Measured memory_bytes: 3896
char S[4040];
i,j;c[99],t;
main(N)
{
	for(scanf("%d%s",&N,S);i<N;c[S[i++]]++)for(j=N-i+1>>1;j--;)t-=(S[i]^S[i+j]^S[i+j+j])==87;
	printf("%ld",1L*c[66]*c[71]*c[82]+t);
}


Measured memory_bytes: 1728
#include<iostream>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  
  if(a == b)
    cout << "Draw";
  else if(a == 1)
    cout << "Alice";
  else if (b == 1)
    cout << "Bob";
  else if(a > b)
    cout <<  "Alice";
  else
    cout << "Bob";

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>
#include <set>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define v_in(v) for(auto&& i : v) cin >> i
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;


int main(void){
    FAST_IO
    
    ll n;
    string s;
    cin >> n >> s;
    if(n % 2 == 1){
        cout << "No" << endl;
        return 0;
    }

    if(s.substr(0,n/2) == s.substr(n/2,n/2)){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3024
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int64_t> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    vector<int64_t> acc(n + 1);
    irep(i, n)
    {
        if (i == 0) {
            acc[i] = 0;
        } else {
            acc[i] = acc[i - 1] + a[i - 1];
        }
    }
    /*rep(i, n)
    {
        for (int j = i + 1; j <= n; j++) {
            int64_t p = acc[j] - acc[i];
            //cout << "i=" << i << " j=" << j << " p=" << p << " bit:\t" << bitset<64>(p) << endl;
        }
    }*/

    int64_t result = 0;
    rrep(i, 64)
    {
        int64_t f = 1L << i;
        int64_t tmp = result | f;

        int cnt = 0;
        rep(i, n)
        {
            for (int j = i + 1; j <= n; j++) {
                int64_t p = acc[j] - acc[i];
                if ((p & tmp) == tmp) {
                    cnt++;
                }
            }
        }
        if (cnt >= k) {
            result = tmp;
        }
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n; cin >> n;

    int ans = 0;
    for(int i = 1; i<=n; ++i) {
        int n = i;
        int tmp = 0;
        while(n) {
            n /= 10;
            tmp++;
        }
        if(tmp %2 == 1) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int p[50000];

void era() {
  for(int i = 2; i < 50000; i++) {
    p[i] = 1;
  }

  for(int i = 2; (i*i) < 50000; i++) {
    if(p[i] == 1) {
      for(int j = (i*2); j < 50000; j+=i)
        p[j] = 0;
    }
  }
}

int main() {
  int n, cnt;
  era();

  while(cin>>n) {
    if(n == 0) break;
    cnt = 0;
    for(int i = 1; (int)i <= (n/2); i++) {
      if(p[i] == 1 && p[n-i] == 1)
	cnt++;
    }
    cout << cnt << endl;;
  }

  return 0;
}



Measured memory_bytes: 3268
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>
#include <list>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
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; }

using namespace std;


int main(void)
{
	double a, b, x; cin >> a >> b >> x;
	double theta = 180./3.1415926535898;
	if (a * a * b > 2 * x)theta *= atan(a * b * b / 2. / x);
	else if(a * a * b == 2 * x)theta *= atan(a / b);
	else theta *= atan(2.*(a*a*b-x)/a/a/a);

	printf("%.7lf\n", theta);
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(void){
    int n, a = 0, b = 0;
    string s;
    
    
    cin >> n;
    cin >> s;
    
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') a++;
        else b++;
    }

    if(a > b){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

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

char grid[10][10];

int main(){
  int h,w,k;
  cin>>h>>w>>k;
  int b=0;
  rep(i,h)rep(j,w){
    cin>>grid[i][j];
    if(grid[i][j]=='#')b++;
  }
  int ans=0;
  for(int i=0; i<(1<<h); i++){
    for(int j=0; j<(1<<w); j++){
      int black=b;
      rep(hi,h){
        if(i>>hi&1){
          rep(wi,w){
            if(grid[hi][wi]=='#')black--;
          }
        }
      }
      rep(wi,w){
        if(j>>wi&1){
          rep(hi,h){
            if(grid[hi][wi]=='#' && !((i>>hi)&1))black--;
          }
        }
      }
      if(black==k)ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; ++i) {
        if (i % d == 0) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3632
# coding: utf-8
# Your code here!
a,b = map(int,input().split())
c = [1 for i in range(a)]
for i in range(b):
    d = int(input())
    e = list(map(int, input().split()))
    for j in range(d):
        c[e[j] - 1] = 0

print(sum(c))

Measured memory_bytes: 9188
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[200100];

int solve() {
    sort(a, a+n);
    map<int, int> m;
    int res = 0;
    for (int i = n-1; i >= 0; i--) {
        if (m[a[i]] > 0) {
            m[a[i]]--;
            res++;
        } else {
            ll t = 1;
            while (t <= a[i]) {
                t *= 2;
            }
            m[t-a[i]]++;
        }
    }
    return res;
}

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

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

    input();
    cout << solve() << endl;
}


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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<vector<int>> g( N );
	for( int i = 0; i < M; i++ ) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back( b );
		g[b].push_back( a );
	}

	vector<int> v( N );
	typedef pair<int, int> P;
	queue<P> que;
	que.push( P( 0, 0 ) );
	v[0] = 1;
	string ans = "IMPOSSIBLE";
	while( !que.empty() ) {
		int d, x;
		tie( d, x ) = que.front();
		que.pop();
		if( x == N - 1 ) {
			ans = "POSSIBLE";
			break;
		}
		if( d >= 2 ) continue;
		for( int e : g[x] ) {
			if( v[e] ) continue;
			que.push( P( d + 1, e ) );
			v[e] = 1;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 16560
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define int ll

#define F first
#define S second
#define _sz(x) (int)x.size()

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

int const N = 100 + 10 ;
int n , x , a[N] , sum ;

int32_t main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;

	cin >> n >> x ;

	for (int i = 0 ; i < n ; i ++) cin >> a[i] , sum += a[i] ;

	if (sum == x) return cout << n << '\n' , 0 ;

	sort(a , a + n) ;
	sum = 0 ;

	for (int i = 0 ; i < n ; i ++) {
		sum += a[i] ;

		if (sum > x) return cout << i << '\n' , 0 ;
	}

	cout << n - 1 << '\n' ;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  string str;cin>>str;
  int n;cin>>n;
  for(int i=0;i<str.size();i++){
    if(('z'-str[i]+1)<=n&&str[i]!='a'){
      n-=('z'-str[i]+1);
      str[i]='a';
      //cout<<n<<endl;
    }
  }
  if(n>=25){
    int aa=n%26;
    n/=26;
    str[str.size()-1]+=aa;
  }else{
    str[str.size()-1]+=n;
  }
  cout<<str<<endl;
  return 0;
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int,input().split()))
sumA = sum(A)%(1000000007)
sumA2 = (sumA * sumA)%(1000000007)
square = 0
for i in range(N):
    square +=  ( A[i]**2 ) % (1000000007)
    square = square % (1000000007)
buf = sumA2 - square
if buf < 0:
  buf = buf + (1000000007)
res = ( buf * ((1000000007+1)//2)) % 1000000007
print(int(res))

Measured memory_bytes: 31560
n,m = map(int, input().split())
lr = [list(map(int, input().split())) for i in range(m)]
L,R = [],[]
for i in lr:
  l,r = i[0],i[1]
  L.append(l)
  R.append(r)
ans = max(min(R) - max(L) + 1,0)
print(ans)

Measured memory_bytes: 29096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

int main(){
  ll a[3]; CINA(a,3);
  cout << (sum(a,3)>=22?"bust":"win");
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] delicious = new int[n];
    int s = 0;
    int ss = 0;
    for(int i = 0; i < n; i++){
      delicious[i] = sc.nextInt();
      s += delicious[i];
      ss += delicious[i] * delicious[i];
    }
    System.out.println((s * s - ss) / 2);
  }
}

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

int w, h, ret;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
string data[25];

void func(int nx, int ny)
{
	ret++;
	data[ny][nx] = '#';
	if (nx+1 < w && data[ny][nx+1] == '.') func(nx+1, ny);
	if (0 <= nx-1 && data[ny][nx-1] == '.') func(nx-1, ny);
	if (ny+1 < h && data[ny+1][nx] == '.') func(nx, ny+1);
	if (0 <= ny-1 && data[ny-1][nx] == '.') func(nx, ny-1);
	
	return;
}

int main(void)
{
	while (cin >> w >> h, w && h){
		for (int i = 0; i < 25; i++) data[i].clear();
		for (int i = 0; i < h; i++) {
			cin >> data[i];
		}
		int sx, sy;
		for (int i = 0; i < w; i++){
			for (int j = 0; j < h; j++){
				if (data[j][i] == '@'){
					sx = i, sy = j;
					break;
				}
			}
		}
		ret = 0;
		data[sy][sx] = '#';
		func(sx, sy);
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
int main(void)
{
	int i,j,k,n,a[100010],flg[100010]={0},cnt,c;
	cin>>n;
	for(i=1;i<=n;i++) {
		cin>>a[i];
		if(i==a[i]) flg[i]=1;
	}
	cnt=c=0;
	for(i=1;i<=n;i++) {
		if(flg[i]==1) c++;
		else if(c!=0){
			if(c%2==0) cnt+=c/2;
			else  cnt+=c/2+1;
			c=0;
		}
	}
	if(c!=0) {
		if(c%2==0) cnt+=c/2;
		else cnt+=c/2+1;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 1024
N = int(input())
a = list(map(int,input().split()))
s=0
for i in range(N):
  while(True):
    if a[i]==0:
      break 
    if a[i]%2==0:
      a[i]=a[i]//2
      s=s+1
      #print(i,a[i],s)
    else:
      break
print(s)

Measured memory_bytes: 10152
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
int x,y;
char a;
for(int i=1;i<=10000;i++)
{cin >> x >> a >> y;
if(a=='+')
{cout << x+y << endl;}
else if(a=='-')
{cout << x-y << endl;}
else if(a=='*')
{cout << x*y << endl;}
else if(a=='/')
{cout << x/y << endl;}
}
return 0;
}



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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int c[] = {0,0,0};
  for(int i = 0; i < N; ++i){
    int p;
    cin >> p;
    if(p <= A) ++c[0];
    else if(p <= B) ++c[1];
    else ++c[2];
  }
  cout << min(c[0],min(c[1],c[2])) << endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
template<typename T>
T minch(T& l, T r) {
    return l = min(l, r);
}
template<typename T>
T maxch(T& l, T r) {
    return l = max(l, r);
}
template<typename T>
void output(const T& val) {
    cout << val << endl;
}
template<typename T>
void output(const vector<T>& vec, const bool newline = false) {
    for (const T& val : vec)cout << val << (newline ? '\n' : ' '); cout << endl;
}
template<typename T>
void output(const vector<vector<T>>& mat) {
    for (const auto& row : mat)output(row);
}
// ============ template finished ============

int main()
{
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC" : "ABC") << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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


int main(){
	
		int a,p;
		cin >> a >> p;
		cout << (3*a+p)/2 <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N= 2e5 + 5;
const ll MOD=1e9 + 7;

ll n,a[N],prfx[N],sfx[N];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(ll i=1;i<=n;i++)cin>>a[i];
    for(ll i=1;i<=n;i++)prfx[i]=prfx[i-1]+a[i];
    for(ll i=n;i>0;i--)sfx[i]=sfx[i+1]+a[i];

    ll ans = LLONG_MAX;
    for(ll i=1;i<n;i++)ans = min(ans , abs(prfx[i] - sfx[i+1]));
    cout<<ans;
}



Measured memory_bytes: 4992
n = int(input())
l = []
for _ in range(n): 
	l.append(input())

def solve():
	
	for i in range(n): 
		for j in range(i+1,n): 
			if l[i] == l[j]:
				print("No")
				return 

	for i in range(n-1):
		actual = l[i+1]
		next_word = l[i]
		if actual[0] != next_word[len(next_word)-1]:
			print("No")
			return 

	print("Yes")

solve()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int x_cand = (int)(n/1.08);
    if((int)(x_cand*1.08) == n) cout << x_cand << endl;
    else if((int)((x_cand+1)*1.08) == n) cout << x_cand+1 << endl;
    else cout << ":(" << endl;
}

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

const int INF = 1145141919;

int main() {
	int N, R, MIN, ANS = -INF;
	cin >> N >> MIN;
	for (int i = 1; i < N; i++) {
		cin >> R;
		ANS = max(ANS, R - MIN);
		MIN = min(R, MIN);
	}
	cout << ANS << endl;
}


Measured memory_bytes: 3108
#include<iostream>
using namespace std;
int get_dig(int a){
	int i;
	for(i=0;a>0;i++){
		a=a/10;
	}
	return i;
}

int main(){
	int a,b;
	while(cin>>a>>b){
		a=a+b;
		b=get_dig(a);
		cout<<b<<endl;
	}
	return 0;
	
}

Measured memory_bytes: 1160
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k == X:
                ans += 1
print(ans)

Measured memory_bytes: 9056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, k;
  string s;
  in2(n, s);
  vector<ll> a, b, c, d(n, 0);
  rep(i, n){
    if(s[i] == 'R')
      a.pb(i);
    if(s[i] == 'B')
      b.pb(i);
    if(s[i] == 'G')
      c.pb(i);
  }
  k = 0;
  ll p, t, u;
  sort(all(a));
  sort(all(b));
  sort(all(c));
  rep(i, a.size()){
    rep(j, b.size()){
      p = 2 * b[j] - a[i];
      t = 2 * a[i] - b[j];
      if((a[i] + b[j]) % 2 == 0){
        u = (a[i] + b[j]) / 2;
        if(u != p && u != t)
          d[u]++;
      }
      if(0 <= p && p <= n - 1)
        d[p]++;
      if(0 <= t && t <= n - 1)
        d[t]++;
    }
  }
  p = a.size() * b.size() * c.size();
  rep(i, c.size()){
    t = d[c[i]];
    p -= t;
  }
  out(p);
  memi;
}


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

ll modinv(ll a,ll m){
   ll b=m,u=1,v=0;
   while(b){
      ll t=a/b;
      a-=t*b; 
      swap(a,b);
      u-=t*v; 
      swap(u,v);
   }
   u%=m;
   if(u<0) u+=m;
   return u;
}

ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}



int main(){
   int x;
   cin>>x;
   int ans=0;
   ans+=(x/500)*1000;
   x=x%500;
   ans+=(x/5)*5;
   cout<<ans;

   return 0;
}

Measured memory_bytes: 256
program main
  implicit integer (a-z)
  sum=0

  read(*,*)n
  nmod=n

  do i=9,1,-1
     sum=sum+nmod/10**i
     nmod=mod(nmod,10**i)
  end do
  sum=sum+nmod

  if(mod(n,sum).eq.0) then
     write(*,*)"Yes"
  else
     write(*,*)"No"
  end if
  
end program main


Measured memory_bytes: 256
//85DTG
//07082020
#include<bits/stdc++.h>
using namespace std;
#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define vi vector <int>
typedef long long ll;
typedef long double ld;
const ld pi=3.1415926535897932384626433;
const ll mod = 998244353;
const ll inf = 1e18;
int main ()
{
   bolt;
   ll t;
   cin>>t;
   if (t>=30)
   {
      cout<<"Yes";
   }
   else cout<<"No";
}

Measured memory_bytes: 3576
#include<stdio.h>
#define N 2000001
#define K 10000

int n,A[N],B[N];

void CountingSort(int[],int[],int);

int main(){

  int i,k=0;

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

  CountingSort(A,B,K);

  for(i=1;i<n;i++) printf("%d ",B[i]);
  printf("%d\n",B[n]);

  return 0;
}

void CountingSort(int A[],int B[],int k){

  int i,j,C[k+2];

  for(i=0;i<=k;i++){
    C[i]=0;
  }

  for(j=1;j<=n;j++){
    C[A[j]]++;
  }

  for(i=1;i<=k;i++){
    C[i]=C[i]+C[i-1];
  }

  for(j=n;j>=1;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

#define EXACT 0
#define SMALLER 1

template<typename T>
bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

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

	ll N=in(),K=in<ll>();
	vector<ll> A=vecin<ll>(N);

	vector<vector<ll>> dp(100,vector<ll>(2,-1));
	dp[0][0]=0;

	REP(i,50){
		ll mask = (1LL<<(49-i));

		ll one=0,zero=0;
		REP(j,N){
			if(A[j]&mask) one++;
			else zero++;
		}

		ll cost1 = mask*zero;
		ll cost2 = mask*one;

		if(dp[i][SMALLER]!=-1){
			chmax(dp[i+1][SMALLER],dp[i][SMALLER]+max(cost1,cost2));
		}
		if(K&mask){
			chmax(dp[i+1][EXACT],dp[i][EXACT]+cost1);
			chmax(dp[i+1][SMALLER],dp[i][EXACT]+cost2);
		}
		else{
			chmax(dp[i+1][EXACT],dp[i][EXACT]+cost2);
		}
	}
	out(max(dp[50][EXACT],dp[50][SMALLER]));
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>

using namespace std;

const int N = 1005;

int n, m, x, y, uk = 0;
char s[N][N];

int main(){
    memset(s, '.', sizeof(s));
    scanf("%d%d", &n, &m);
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            scanf(" %c", &s[i][j]);
        	uk += (s[i][j] == '#');
        }
    }
  	
    if(s[0][0] != '#' || uk != n + m - 1){printf("Impossible\n");return 0;}
    for(;x != n - 1 || y != m - 1;){
        int cnt = (s[x][y + 1] == '#') + (s[x + 1][y] == '#');
        if(cnt != 1){printf("Impossible\n");return 0;}
        if(s[x][y + 1] == '#') y++;
        else x++;
    }
    printf("Possible\n");
}


Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String A = scan.next();
		String B = scan.next();
		String C = scan.next();
		if(A.substring(A.length() - 1, A.length()).equals(B.substring(0, 1)) && B.substring(B.length() - 1, B.length()).equals(C.substring(0, 1))) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		scan.close();

	}

}


Measured memory_bytes: 23764
num1=[]
num2=[]
for i in range(28):
    x=int(input())
    num1.append(x)
    
num1.sort()

c=0
if num1[0]==1:
    pass
else:
    num2.append(1)
    c+=1
y=0
while y<27:
    z=y+1
    a=num1[y]
    b=num1[z]
    t=int(b-a)
    if t==2:
        num2.append(z+c+1)
        c+=1
    else:
        pass
    y+=1
if c==2:
    pass
else:
    num2.append(30)
print(num2[0])
print(num2[1])


Measured memory_bytes: 5600
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  const double pi=3.141592653589793;
  double r,a,b;
  cin >> r ;
  a=pi*r*r;
  b=2*pi*r;
  printf("%.7f %.7f\n",a,b);
}



Measured memory_bytes: 3200