akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=200005;
struct edge{int x,y,next;}a[2*MAXN];int len,last[MAXN];
void ins(int x,int y){len++;a[len].x=x;a[len].y=y;a[len].next=last[x];last[x]=len;}
int n,fx,fy,dep[MAXN],fa[25][MAXN],bin[25];
vector<int> nxt[MAXN];
void dfs(int x)
{
	for(int i=1;bin[i]<=dep[x];i++)fa[i][x]=fa[i-1][fa[i-1][x]];
	for(int k=last[x];k;k=a[k].next)
	{
		int y=a[k].y;
		if(y!=fa[0][x])dep[y]=dep[x]+1,fa[0][y]=x,dfs(y);
	}
}
int lca(int x,int y)
{
	if(dep[x]<dep[y])swap(x,y);
	for(int i=18;i>=0;i--)if(bin[i]<=dep[x]&&dep[fa[i][x]]>=dep[y])x=fa[i][x];
	if(x==y)return x;
	for(int i=18;i>=0;i--)if(bin[i]<=dep[x]&&fa[i][x]!=fa[i][y])x=fa[i][x],y=fa[i][y];
	return fa[0][x];
}
int getdis(int x,int y){return dep[x]+dep[y]-2*dep[lca(x,y)];}
int mx;
namespace S
{
	queue<pii> li;
	int di[MAXN],fa[MAXN];
	vector<int> num[MAXN];
	void init(int x)
	{
		num[di[x]].push_back(x);
		for(int k=0;k<nxt[x].size();k++)
		{
			int y=nxt[x][k];
			if(y!=fa[x])di[y]=di[x]+1,fa[y]=x,init(y);
		}
	}
	bool vis[MAXN];
	void main()
	{
		init(fx);vis[0]=1;
		for(int i=0;i<=n;i++)for(int j=0;j<num[i].size();j++)
		{
			bool tf=false;int x=num[i][j];vis[x]=vis[fa[x]]&(i<dep[x]);
			if(vis[x])
			{
				for(int k=0;k<nxt[x].size();k++)if(getdis(x,nxt[x][k])>2){tf=true;break;}
				if(tf&&i<dep[x]){puts("-1");exit(0);}
				if(i<=dep[x])mx=max(mx,dep[x]);
			}
		}
	}
}
int main()
{
//	freopen("a.in","r",stdin);
	bin[0]=1;for(int i=1;i<=20;i++)bin[i]=bin[i-1]<<1;
	n=read();fx=read();fy=read();
	for(int i=1;i<n;i++)
	{
		int x=read(),y=read();
		nxt[x].push_back(y);nxt[y].push_back(x);
	}
	for(int i=1;i<n;i++)
	{
		int x=read(),y=read();
		ins(x,y);ins(y,x);
	}dfs(fy);
	S::main();
	pr2(2*mx);
	return 0;
}


Measured memory_bytes: 51840
h,w,k = map(int,input().split())

c = [['r' for j in range(w)] for i in range(h)]

for i in range(h):
  c[i] = list(input())
ans = 0

for i in range(2**h):
  x = 0
  h_flag = [0]*(h)
  while i != 0:
      if i % 2 == 1:
        h_flag[x] = 1
      i = i // 2
      x += 1
  for j in range(2**w):
    black = 0
    w_flag = [0]*(w)
    y = 0
    while j != 0:
      if j % 2 == 1:
        w_flag[y] = 1
      j = j // 2
      y += 1
    for m in range(h):
      for n in range(w):
        if c[m][n] == '#' and h_flag[m] == 0 and w_flag[n] == 0:
          black += 1
#    print(h_flag,w_flag,black)
    if black == k:
      ans += 1

print(ans)

Measured memory_bytes: 9172
#NOT嘘
H,W,N = gets.split.map(&:to_i)
sr,sc = gets.split.map(&:to_i)
l,r,u,d = 1,W,1,H
S = gets.chomp
T = gets.chomp

(N-1).downto(0) do |i|
  if i <= N-2
    c = T[i]
    if c == "L"
      r += 1 if r < W
    elsif c == "R"
      l -= 1 if l > 1
    elsif c == "U"
      d += 1 if d < H
    elsif c == "D"
      u -= 1 if u > 1
    end
  end

  c = S[i]
  if c == "L"
    l += 1
  elsif c == "R"
    r -= 1
  elsif c == "U"
    u += 1
  elsif c == "D"
    d -= 1
  end

  #p [l,r,u,d]
  if l > r || u > d
    puts "NO"
    exit
  end

end
puts (l <= sc && sc <= r && u <= sr && sr <= d) ? "YES" : "NO"


Measured memory_bytes: 2640
#include <bits/stdc++.h>
using namespace 
std;int main() {
  
  int N,M,uke;
  int sum = 0;
  cin >> N >> M;
  
  for(int i = 0; i < M; i++){
    cin >> uke;
    sum += uke;
  }
  if(N - sum < 0)
    cout << -1 << endl;
  else
    cout << N - sum << endl;
}


Measured memory_bytes: 3636
#include <cstdio>
 
/*
max(N- [x2, ..., xN] [ 1 2 3 4 ... 4 3 2], 0)
 
(1 + z + z^2 + ... + z^N) (1 + z^2 + z^4 + ... + z^{2N}) ...
f(z) = 1/[(1-z){(1-z^2)(1-z^3)...(1-z^{N/2})}^2]
 
 
[z^N] (N f(z) - z * f'(z))/(1-z)
[z^N] (f(z)(N - z * f'(z)/f(z)))/(1-z)
 
f'(z)/f(z) = 1/(1-z) + 2(2z/(1-z^2) + 3z^2/(1-z^3) + ...
 
log f = \sum_{i=2}^{N/2}
 
f(z) = (1-z)(1-z^{N/2+1})^2(1-z^{N/2+2})^2... / [(1-z)(1-z^2)...]^2
f(z) = (1-z)(1-2z^{N/2+1})(1-2z^{N/2+2})... / [(1-z)(1-z^2)...]^2
f(z) = (1-z)(1-2z^{N/2+1}-2z^{N/2+2}-...) / [(1-z)(1-z^2)...]^2
f(z) = (1-z-2z^{N/2+1}) / [(1-z)(1-z^2)...]^2

[z^N] (Nz^N + (N-1)z^{N-1} + .. z + 0) f(z)
[z^{N-1}] (Nz^{N-1} + (N-1)z^{N-2} + .. 2z + 1) f(z)
[z^{N-1}] 1/(1-z)^2 f(z)
 
f(z) = 1/[(1-z)(1-z^2)(1-z^3)...(1-z^{N/2})]^2
f(z) = (1-2z^{N/2+1} - ... )/[(1-z)(1-z^2)...]^2
f(z) = (1-z-2z^{N/2+1})/{(1-z)[(1-z)(1-z^2)...]^2}
*/

 
int n, m;
 
int dp[5000];

int main(){
  scanf("%d%d", &n, &m);
 
  dp[0] = 1;
  dp[1] = m-1;
  dp[(n+1)/2+1] = m-2;
 
  if(n & 1){
    dp[(n+1)/2] -= 1;
    dp[(n+1)/2+1] += 1;
    if(dp[(n+1)/2] < 0) dp[(n+1)/2] += m;
  }
  
  for(int t = 0; t < 2; t++){ 
    for(int i = 1; i < n; i++){
      dp[i] += dp[i-1];
      if(dp[i] >= m) dp[i] -= m;
    }
    for(int i = 0; i < n; i++){
      long long int tmp = dp[i];
      for(int j = 1; ; j++){
        int k = j * (3 * j - 1) / 2;
        if(k > i) break;
        if(j&1){
          tmp += dp[i - k];
        }
        else {
          tmp -= dp[i - k];
        }
        k += j;
        if(k > i) break;
        if(j&1){
          tmp += dp[i - k];
        }
        else {
          tmp -= dp[i - k];
        }
      }
      dp[i] = tmp % m;
      if(dp[i] < 0) dp[i] += m;
    }
  }
 
  printf("%d\n", dp[n-1]);
 
 
  return 0;
}


Measured memory_bytes: 128
n = int(input())
nums = [int(input()) for _ in range(n)]
if nums[0] != 0:
    print(-1)
    exit()

ans = 0
for i in range(1, n):
    if nums[i] - nums[i-1] > 1:
        print(-1)
        exit()
    if nums[i] == 0:
        continue
    if nums[i] - nums[i-1] == 1:
        ans += 1
    else:
        ans += nums[i]
print(ans)

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

int main(int argc, char* argv[]) {
  int n;
  char a, b;
  cin >> n;
  while(n != 0){
    map<char, char> m;

    for(int i=0 ; i<n ; i++){
      cin >> a >> b;
      m.insert(pair<char, char>(a, b));
    }

    cin >> n;
    for(int i=0 ; i<n ; i++){
      cin >> a;
      if(m.find(a) == m.end()){
        cout << a;
      }else{
        cout << m[a];
      }
    }
    cout << endl;

    cin >> n;
  }

  return 0;
}

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

int main() {
    int n, m, x = 0;
    cin >> n >> m;
    long l = 1;
    cin >> l;
    while(!(l & 1 << x))
        x++;
    for(int i = 1; i < n; i++) {
        long a, v = 0;
        cin >> a;
        while(!(a & 1 << v))
            v++;
        if(v != x) {
            cout << 0 << endl;
            return 0;
        }
        l = l / __gcd(a, l) * a;
    }
    cout << m / (l / 2) - m / l << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n,k,kari,a,b,c,e;
  bool done;
  bool out[11];
  cin>>n>>k;
  int d[k];
  for(int i=0;i<11;i++){
    out[i]=false;
  }
  for (int i=0;i<k;i++){
    cin>>kari;
    out[kari]=true;
    if(kari==0){
      out[10]==true;
    }
  }
  int digit;
  digit=(int)log10((double)n)+1;
  for(int i=0;i<digit;i++){
    done=false;
    for(int j=0;j<10;j++){
      a=pow(10,i+1);
      b=pow(10,i);
      c=((n%a)-(n%b))/pow(10,i);
      if(out[c]==true){

        if(done==false&&i!=0){
          done=true;
          e=pow(10,i);
          n-=n%e;
          for(int m=0;m<i;m++){
            for(int p=0;p<10;p++){
              if(out[p]==false){
                n=n+p*pow(10,m);
                break;
              }
            }
          }
        }
        n=n+pow(10,i);
      }

    }
      if(digit!=(int)log10((double)n)+1){
        digit++;
      }
    }

cout<<n<<endl;
}


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

int judge(int index, int* array, int N) {
    int result=0;
    for(int i=index+1;i<N;i++){
        for(int j=i+1;j<N;j++){
            if ((*(array+i) + *(array+j)) > *(array+index)) {
                result += 1;
            }
            else {
                break;
            }
        }
    }
    return result;
}

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

    int N;
    cin >> N;
    int n_array[N];
    rep(i, N) {cin >> n_array[i];}
    
    //　昇順でソート
    sort(n_array, n_array+N, greater<>());
    int num, result, sum=0;
    rep(i, N){
        result=judge(i, n_array, N);
        sum += result;}
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lb(x) x&-x
#define il inline
#define ll long long
#define llu unsigned long long
#define mem(x) memset(x,0,sizeof(x))
#define mem3(x) memset(x,0x3f,sizeof(x))
#define ccA() puts("耐心冷静查代码")
#define cc() puts("谁知盘中餐，粒粒皆辛苦")
#define fo(i,a,b) for(register int i=a;i<=b;++i)
#define fd(i,a,b) for(register int i=a;i>=b;--i)
#define fk(i,j) for(register int i=fir[j];i;i=nxt[i])
using namespace std;
inline ll read(){
    ll x=0,f=1;char c;
    for(c=getchar();c<'0'||c>'9';f=((c=='-')?-1:f),c=getchar());
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=getchar());
    return x*f;
}
inline void write(ll a){
    if(a==0){putchar('0');return;}
    if(a<0)putchar('-'),a=-a;
    char c1[120];
    ll h=0;
    while(a)c1[++h]=a%10+'0',a/=10;
    fd(i,h,1)putchar(c1[i]);return;
}
inline void write_(ll a){write(a);putchar(' ');}
inline void writeln(ll a){write(a);putchar('\n');}
//------------------------------------------------------
const int N=2e4+9;
int n,ans,tot,c[N],x,y,cnt,an[N],d[N],num;
int fir[N],nxt[N<<1],v[N<<1],du[N];
struct node{
	int num,du;
}a[N];
bool operator <(const node &a,const node &b){
	return a.du<b.du;
}priority_queue<node> q[N];
void add(int x,int y){
	v[++tot]=y;
	nxt[tot]=fir[x];
	fir[x]=tot;
}
void dfs(int x,int fa){
	d[x]=c[cnt--];
	fk(i,x){
		int y=v[i];
		if(y==fa)continue;
		q[x].push((node){y,du[y]});
	}
	while(q[x].size()){
		int y=q[x].top().num;
		q[x].pop();
		dfs(y,x);
		num+=min(d[x],d[y]);
	}
}
bool cmp(int x,int y){
	return x>y;
}
int mx;

int main(){
	n=read();
	cnt=n;
	fo(i,1,n-1){
		x=read(),y=read();
		add(x,y),add(y,x);
		du[x]++,du[y]++;
	}
	fo(i,1,n){
		c[i]=read();
	}
	sort(c+1,c+1+n);
	fo(i,1,n)mx=max(mx,du[i]);
	fo(i,1,n)
		if(du[i]==mx){
			cnt=n,num=0;
			dfs(i,0);
			if(num>ans){
				ans=num;
				fo(j,1,n)an[j]=d[j];
			}break;
		}
		
	
	writeln(ans);
	fo(i,1,n)write_(an[i]);
	return 0;
}


Measured memory_bytes: 2048
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

void mod_inverse(int n, vector<long long>& inv, int mod)
{
    inv.assign(n+1, -1);
    inv[1] = 1;
    for(int i=2; i<=n; ++i)
        inv[i] = inv[mod % i] * (mod - mod / i) % mod;
}

class FactorialCalculation
{
private:
    const int mod;
    vector<long long> factorial;
    vector<long long> invFactorial;
public:
    FactorialCalculation(int n, int mod) : mod(mod)
    {
        factorial.resize(n+1, 1);
        invFactorial.resize(n+1, 1);
        vector<long long> inv;
        mod_inverse(n, inv, mod);
        for(int i=1; i<=n; ++i){
            factorial[i] = factorial[i-1] * i % mod;
            invFactorial[i] = invFactorial[i-1] * inv[i] % mod;
        }
    }
    long long getFactorial(int n){
        return factorial[n];
    }
    long long getInvFactorial(int n){
        return invFactorial[n];
    }
    long long getPermutation(int n, int r){
        if(n < r)
            return 0;
        return factorial[n] * invFactorial[n-r] % mod;
    }
    long long getCombination(int n, int r){
        if(n < r)
            return 0;
        return getPermutation(n, r) * invFactorial[r] % mod;
    }
    long long getHomogeneous(int n, int r){
        return getCombination(n+r-1, r);
    }
};

const int MOD = 1000000007;
const int INV2 = 500000004;

int main()
{
    int b, w;
    cin >> b >> w;

    FactorialCalculation fc(b+w, MOD);
    long long wCnt = 0;
    long long bCnt = 0;
    long long pow2 = 1;
    long long inv2 = 1;
    for(int i=0; i<b+w; ++i){
        wCnt *= 2;
        wCnt += fc.getCombination(i-1, w-1);
        wCnt %= MOD;
        bCnt *= 2;
        bCnt += fc.getCombination(i-1, b-1);
        bCnt %= MOD;

        long long ans = pow2 - bCnt + wCnt + MOD;
        ans %= MOD;

        pow2 *= 2;
        pow2 %= MOD;
        inv2 *= INV2;
        inv2 %= MOD;

        ans *= inv2;
        ans %= MOD;
        cout << ans << endl;
    }

    return 0;
}


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

const int inf=1e9;
int n;
int a[20010],b[20010],f[20010];

int main()
{int i,j,x;
 
 scanf("%d",&n);
 for(i=1;i<=n;i++)
 {	scanf("%d",&x);
 	f[x]=i;
 }
 a[1]=1;
 b[1]=inf;
 for(i=2;i<=n;i++)
 {	x=f[i]-f[i-1];
 	if(x<0)
 	{	a[i]=a[i-1]+1;
 		b[i]=b[i-1]-1+x;
 	}
 	else if(x==0)
 	{	a[i]=a[i-1]+1;
 		b[i]=b[i-1]-1;
 	}
 	else
 	{	a[i]=a[i-1]+1+x;
 		b[i]=b[i-1]-1;
 	}
 }
 for(i=1;i<=n;i++)
 {	printf("%d",a[i]);
 	printf("%c",i!=n?' ':'\n');
 }
 for(i=1;i<=n;i++)
 {	printf("%d",b[i]);
 	printf("%c",i!=n?' ':'\n');
 }
 return 0;
}

Measured memory_bytes: 1024
def main():
    s = input()
    mod = 2019
    mod_count = {i: 0 for i in range(mod)}
    now_num = 0
    base = 1
    for i in range(len(s) - 1, -1, -1):
        mod_count[now_num] += 1
        now_num += base * int(s[i])
        now_num %= mod
        base *= 10
        base %= mod
    ans = 0
    mod_count[now_num % mod] += 1
    for i in range(mod):
        ans += mod_count[i] * (mod_count[i] - 1) // 2
    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 9268
#include <bits/stdc++.h>
using namespace std;
#define vll vector<long long>
#define mll map<long long,long long>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define pb push_back
#define prll pair<long long,long long>
typedef long long ll;
typedef long double ld;
#define rep(i,a,n)   for(ll i=a; i<n; i++)
#define rrep(i,a,n)  for(ll i=n-1; i>=a; i--)
typedef map<string,ll> msl;
#define mx 100001
#define mod 1000000007
ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll extgcd(ll a,ll b,ll& x,ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}
ll revrsno(ll n){
    ll k=0;
    vll z;
    while(n>0){
        z.pb(n%10);
        n/=10;
    }
    rep(i,0,z.size()) k=k*10+z[i];
    return k;
}
bool isPrime(ll n){
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}
bool isPowerOfTwo(ll n) { 
   if(n==0) 
   return false; 
   return (ceil(log2(n)) == floor(log2(n))); 
}
ll powm(ll a,ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}
ll divide(ll a,ll b) {
	return (a % mod) * powm(b, mod - 2) % mod;
}
ll mul(ll a,ll b) {
	return ((a % mod) * (b % mod)) % mod;
}
 
ll add(ll a,ll b) {
	return (a % mod + b % mod) % mod;
}
ll Totfun(ll n){
    ll z=n;
    if(n%2==0){
        while(n%2==0){
            n/=2;
        }
        z/=2;
    }
    for(ll i=3;i<=sqrt(n);i+=2){
        if(isPrime(i)&&n%i==0){
          while(n%i==0){
            n/=i;
          }
        z-=z/i;  
        }
    }
    if(n>1){
        z-=z/n;
    }
    return z;
}
ll maxPrimeFactor(ll n) { 
    ll maxPrime=-1; 
    while(n%2==0){
        maxPrime=2; 
        n>>=1; 
    } 
    for (ll i=3;i<=sqrt(n);i+=2) { 
        while(n%i==0){ 
            maxPrime=i; 
            n=n/i; 
        } 
    } 
    if (n>2) maxPrime=n; 
    return maxPrime; 
} 
ll nCr(ll n,ll r){
    if(r>n||r<0) return 0;
    ll z=1;
    for(ll i=n-r+1;i<=n;i++){
        z*=i;
        z/=(i+r-n);
    }
    return z;
}
/*
vll a[mx];
ll l[mx],d[mx];
void dfs(ll x,ll y){
   l[x]=1; d[x]=y;
   for(ll i:a[x])
   if(!l[i])
   dfs(i,y+1);
}
void bfs(ll x){
    queue<ll> q;
    q.push(x);
    l[x]=1;
    d[x]=0;
    while(!q.empty()){
        ll cur=q.front();
        q.pop();
        for(ll i : a[cur]){
            if(1-l[i]){
                q.push(i);
                d[i]=d[cur]+1;
                l[i]=1;
            }
        }
    }
}
*/
 
int main(){
   ios_base::sync_with_stdio(false); 
   cin.tie(NULL);
   cout.tie(NULL);
   ll a,b,x,y;
   cin>>a>>b;
   ll ans=-1;
   for(ll i=a*12;i<b*20;i++){
    x=i;
    y=i;
    x*=8;
    x/=100;
    y/=10;
    if(x==a&&y==b){
        ans=i;
        break;
    }
   }
   cout<<ans;
   return 0;
}

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define quicker ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;

vector<vector<int>> adj;

int main()
{
    quicker
    #ifdef HALO
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, x, y;

    cin >> n >> x >> y;
    adj = vector<vector<int>> (n + 1);
    for (int  i = 1; i < n; i++)
    {
      adj[i].pb(i + 1);
      adj[i + 1].pb(i);
    }
    if (x != y + 1 && (x != y - 1)){
      adj[x].pb(y);
      adj[y].pb(x);
    }
    int A[2001][2001] = {0};
    for (int i = 1; i <= n; i++)
    {
      A[i][i] = 0;
      bool visited[3000] = {false};
      queue<int> Q;
      Q.push(i);
      int v, cnt = 0;
      visited[i] = true;
      while(!Q.empty())
      {
        v = Q.front();
        Q.pop();
        for (auto u : adj[v])
        {
          if (!visited[u])
          {
            visited[u] = true;
            A[i][u] = A[i][v] + 1;
            Q.push(u);
          }
        }
      }
    }
    int B[20000] = {0};
    for (int i = 1; i <= n; i++)
    {
      for (int j = i + 1; j <= n; j++)
        ++B[A[i][j]];
    }
    for (int i = 1; i < n; i++)
    cout << B[i] << endl;
  }

Measured memory_bytes: 16128
N, C = map(int, input().split())
X = []; V = []
for i in range(N):
    x, v = map(int, input().split())
    X.append(x); V.append(v)
P0 = []; P1 = []
ma0 = cu0 = ma1 = cu1 = 0
pos = 0
for i in range(N):
    cu0 += V[i]-(X[i]-pos)
    cu1 += V[i]-(X[i]-pos)*2
    ma0 = max(ma0, cu0)
    ma1 = max(ma1, cu1)
    P0.append(ma0)
    P1.append(ma1)
    pos = X[i]
Q0 = []; Q1 = []
ma0 = cu0 = ma1 = cu1 = 0
pos = C
for i in range(N):
    cu0 += V[-i-1]-(pos-X[-i-1])
    cu1 += V[-i-1]-(pos-X[-i-1])*2
    ma0 = max(ma0, cu0)
    ma1 = max(ma1, cu1)
    Q0.append(ma0)
    Q1.append(ma1)
    pos = X[-i-1]
ans = max(P0[N-1], Q0[N-1])
for i in range(N-1):
    ans = max(ans, P0[i] + Q1[-i-2], P1[-i-2] + Q0[i])
print(ans)


Measured memory_bytes: 25916
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int d;
  vector<int> v;
  for(int i=0;i<n;i++)
  {
    cin>>d;
    v.push_back(d);
  }
  int count=0;
  int min=v[0];
  //reverse(v.begin(),v.end());
  for(int i=0;i<v.size();i++)
  {
  	if(v[i]<min)
  		min=v[i];
  	if(min>=v[i])
  		count++;
  	
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 1400
N = int(input())
A = input().split()
S = [0] * (N + 1)

for i in range(N):
    S[i + 1] = S[i] + int(A[i])

S.sort()
zero = 0
same_number = 0
for i in range(1,N + 1):
    if S[i] == S[i-1]:
        same_number += 1
    else:
        if same_number > 0:
            zero = zero + ((same_number * (same_number + 1)) / 2)
        same_number = 0

if same_number > 0:
    zero = zero + (same_number * (same_number + 1) / 2)

print(int(zero))

Measured memory_bytes: 33352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
const int MAXN = 2e5 + 5, MAXM = 2e5 + 5, BOUND = 1e7, MOD = 1073741824, INF = 0x3f3f3f3f, base = 10000;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0), eps = 1e-9;
#define mid l + ((r-l)>>1)
#define lson o<<1,l,m
#define rson o<<1|1,m+1,r
#define lc(x) ch[x][0]
#define pii pair<int,int>
#define vi vector<int>
#define RR register int
#define rc(x) ch[x][1]
#define rep(i,a,b) for(RR i=(a);i<=(b);++i)
#define random(a,b) ((a)+rand()%((b)-(a)+1))
int h, w, n, x, y, sr, sc;
char s[MAXN], t[MAXN];
int main() {
	cin >> h >> w >> n;
	cin >> sr >> sc;
	cin >> (s + 1) >> (t + 1);
	bool ans = true;
	x = sr, y = sc;
	//向右
	rep(i, 1, n) {
		if (s[i] == 'R') y = y + 1;
		if (y > w) {
			ans = false;
			break;
		}
		if (t[i] == 'L') y = max(1, y - 1);
	}

	//向左
	x = sr, y = sc;
	rep(i, 1, n) {
		if (s[i] == 'L') y = y - 1;
		if (y < 1) {
			ans = false;
			break;
		}
		if (t[i] == 'R') y = min(w, y + 1);
	}

	//向下
	x = sr, y = sc;
	rep(i, 1, n) {
		if (s[i] == 'D') x = x + 1;
		if (x > h) {
			ans = false;
			break;
		}
		if (t[i] == 'U') x = max(1, x - 1);
	}

	//向上
	x = sr, y = sc;
	rep(i, 1, n) {
		if (s[i] == 'U') x = x - 1;
		if (x < 1) {
			ans = false;
			break;
		}
		if (t[i] == 'D') x = min(h, x + 1);
	}
	if (ans)cout << "YES\n";
	else cout << "NO\n";
	return 0;
}

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

int main() {
  int count=0;
  int N;
  cin>>N;
  switch(N){
    case 1:
        case 2:
        case 3:
        case 5:
        case 6:
        case 9:
        case 10:
        case 13:
        case 17:
        cout<<"No";
  return 0;
    default:
      cout<<"Yes";
  }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import defaultdict

n = int(input())
d = defaultdict(int)
for _ in range(n):
	s = ''.join(sorted(list(input().strip())))
	d[s] += 1
ans = 0
for x in d.values():
	ans += x * (x - 1) // 2
print(ans)
	

Measured memory_bytes: 58844
splitBy :: Char -> String -> [String]
splitBy _ [] = []
splitBy a x =
  let s = takeWhile (/= a) x
      x'= dropWhile (/= a) x
  in
    if x' == []
    then [s]
    else s:(splitBy a $ drop 1 x')

dist :: [Double] -> [Double] -> Double
dist [x0,y0] [x1,y1] = sqrt( (x1-x0)**2 + (y1-y0)**2 )

ans' :: [Double] -> [[Double]] -> Double
ans' p []     = 0
ans' p (q:[]) = 0

ans' p (q:r:s) =
  let a = dist p q
      b = dist q r
      c = dist p r
      z = (a+b+c) / 2
      w = sqrt( z * (z - a) * (z - b) * (z - c) )
  in
    w + (ans' p (r:s))

ans :: [[Double]] -> Double
ans (a:d) = ans' a d
  
main = do
  c <- getContents
  let i = map (map read) $ map (splitBy ',') $ lines c :: [[Double]]
      o = ans i
  print o

Measured memory_bytes: 3916
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, M;
  cin >> N >> M;
  if (M == 1) {
    cout << 1 << " " << 2 << endl;
    return 0;
  }
  REP(i, M) {
    if (N % 2 == 0) {
      if (i < M / 2)
        cout << 1 + i << " " << 2 * M + 1 - i << endl;
      else
        cout << 1 + i << " " << 2 * M - i << endl;
    } else {
      cout << 1 + i << " " << 2 * M - i << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
char s[Max];
int main()
{
	int len;
	int a,b,c;
	a=0,b=0,c=0;
	scanf("%s",s);
	len=strlen(s);
	for(int i=0;s[i];i++)
		if(s[i]=='a')
			a++;
		else if(s[i]=='b')
			b++;
		else if(s[i]=='c')
			c++;
	if(a==0 || b==0 || c==0)
	{
		if(len>=3)
		{
			printf("NO\n");
			return 0;
		}
	}
	int ans=min(a,min(b,c));
	a-=ans;
	b-=ans;
	c-=ans;
	if(a>=2 || b>=2 || c>=2)
		printf("NO\n");
	else if((a+b+c)<3)
		printf("YES\n");
	else
		printf("NO\n");
    return 0;
}


Measured memory_bytes: 384
import sys
import itertools
input = sys.stdin.readline


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


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def root(P, C, a):
    if P[a] == a:
        return a
    r = a
    while P[r] != r:
        r = P[r] 
    
    P[a] = r
    C[a] = C[r]
    return r


def main():
    N, M = read_values()
    V = [read_list() for _ in range(M)]
    P = [i for i in range(N)]
    C = [1] * N
    res = [N * (N - 1) // 2] * M
    total = 0
    for i in range(M - 2, -1, -1):
        a, b = V[i + 1]
        a -= 1
        b -= 1

        ra = root(P, C, a)
        rb = root(P, C, b)
        if ra == rb:
            res[i] -= total
            continue

        P[ra] = rb
        total += C[ra] * C[rb]
        C[ra] += C[rb]
        C[rb] = C[ra]
        res[i] -= total

    print("\n".join(map(str, res)))
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 47060
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=3;i++){
        if(a*b*i%2!=0){
            cout<<"Yes"<<endl;
            break;
        }
        else{
            cout<<"No"<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
/*
ID: jerrywcy
TASK: AtCoder ABC 101 Problem B
LINK: https://abc102.contest.atcoder.jp/tasks/abc102_b
LANG: C++
*/
#include <bits/stdc++.h>

using namespace std;

int n;

int sum(int n){
	int ret=0;
	while (n){
		ret+=n%10;
		n/=10;
	}
	return ret;
}

int main(){
	cin>>n;
	if (n%sum(n)==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <iostream>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long llu;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
const ll MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;


int main() {
	ll n, k;
	scanf("%lld %lld", &n, &k);

	ll ans = 0;
	for (ll b = k + 1; b <= n; b++) {
		ll mk = n - n / b * b;
		if (mk + 1 <= k) ans += (n / b) * (b - k);
		else ans += (n / b + 1) * (mk - k + 1) + (n / b) * (b - mk - 1);

		// printf("%lld %lld %lld\n", b, mk, ans);
	}

	if (k == 0) ans -= n;
	printf("%lld", ans);
}

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    if(n == 1)
    {
        cout << "Hello World";
    }
    else
    {
        int a, b;
        cin >> a >> b;
        cout << a+b;
    }
    return 0;
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

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

    string s;
    cin >> s;
    string t = s;
    reverse(All(t));

    int cou = 0;
    REP(i, s.size() /2){
        if(s[i] != t[i]){
            cou++;
        }
    }

    cout << cou << endl;

}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

def main():
    H,W = map(int, input().split())
    
    S = []
    for _ in range(H):
        S.append(input().strip()+"#") # 末尾に壁を足すと後が楽になる
    S.append("#"*W) # 同上

    # グリッド y,x を含む横方向の "." の最大長
    grid_x = [[0]*(W+1) for _ in range(H)]
    for y in range(H):
        l = r = 0
        for x in range(W+1):
            if S[y][x] == "#":
                r = x
                for i in range(l,r):
                    grid_x[y][i] = r-l
                grid_x[y][x] = 0
                l = x+1

    # グリッド y,x を含む縦方向の "." の最大長
    grid_y = [[0]*W for _ in range(H+1)]
    for x in range(W):
        u = d = 0
        for y in range(H+1):
            if S[y][x] == "#":
                d = y
                for i in range(u,d):
                    grid_y[i][x] = d-u
                grid_y[y][x] = 0
                u = y+1

    ans = 0
    for y in range(H):
        for x in range(W):
            ans = max(ans, grid_x[y][x]+grid_y[y][x]-1)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 122204
# -*- coding: utf-8 -*-
import sys, copy, math, itertools
from copy import *
from collections import deque
import numpy as np
from heapq import *
from bisect import *
import scipy as sp
from scipy import special, signal, ifft
from scipy.fftpack import fft
#from scipy.optimize import linprog		# AtCoderでは使えず

A, B, C = list( map(int, input().split() ) )

if A==B: print(C)
if B==C: print(A)
if C==A: print(B)

Measured memory_bytes: 48128
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6+3;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
 
 
ll binary_search(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<arr[m]){
        return binary_search(arr,val,l,m);
    }
    else{
        return binary_search(arr,val,m+1,r);
    }
}//return position less than
ll binary_search2(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<=arr[m]){//changed here
        return binary_search2(arr,val,l,m);
    }
    else{
        return binary_search2(arr,val,m+1,r);
    }
}//return position less than or equal
ll power(ll x, ll y) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % mod;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll n) 
{ 
    return power(n, mod-2); 
}
ll gcdl(ll a ,ll b){ 
    if (a == 0) 
        return b;  
    return gcdl(b % a, a);  
 }

int main()
{   ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    char c;
    cin>>c;
    printf("%c",c+1);

    return 0;
             
    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int i,count=0;
	char w[11],m[101];
	scanf("%s",&w);
	while (1){
		scanf("%s",&m);
		if (strcmp("END_OF_TEXT",m)==0) break;
		for (i=0;i<101;i++){
			if (m[i]>='A'&&m[i]<='Z')
				m[i]=m[i]+32;
		}
		if (strcmp(w,m)==0) count++;
	}
	printf("%d\n",count);
	return 0;
}	


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S)
{
    if (S[2] == S[3] && S[4] == S[5])
        cout << YES << endl;
    else
        cout << NO << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
#define LL long long
#define P pair<int,int>
#define LP pair<LL,LL>
int N, M;
int ans[100010];
int in[100010];
vector<int> G[100010];
int main(){
    cin >> N >> M;
    for(int i = 1; i < N + M; i++){
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        in[b]++;
    }
    queue<int> q;
    for(int i = 1; i <= N; i++){
        if(in[i] == 0) q.push(i);
    }
    while(!q.empty()){
        int t = q.front();
        q.pop();
        for(auto u : G[t]){
            in[u]--;
            if(in[u] == 0){
                ans[u] = t;
                q.push(u);
            }
        }
    }
    for(int i = 1; i <= N; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 7040
import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int W,H,x,y,r;
        W = sc.nextInt();
        H = sc.nextInt();
        x = sc.nextInt();
        y = sc.nextInt();
        r = sc.nextInt();
        if(x-r < 0 || x+r > W || y+r > H || y-r < 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}


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

int main(){
    int n,m;
    cin >> n;
    vector <string> blue;
    for(int i=0;i<n;i++){
        string tmp;
        cin >> tmp;
        blue.push_back(tmp);
    }

    cin >> m;
    vector<string>red;
    for(int i=0;i<m;i++){
        string tmp;
        cin >> tmp;
        red.push_back(tmp);
    }
    int ans = 0;

    for(int i=0;i<blue.size();i++){
        int tmp = 0;
        for(int j=0;j<blue.size();j++){
            if(blue[i] == blue[j]){
                tmp ++;
            }
        }
        for(int j=0;j<red.size();j++){
            if(blue[i] == red[j]){
                tmp --;
            }
        }
        if(tmp > ans){
            ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] a = new int[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		sc.close();

		int n2 = 1 << n;
		long[] dp = new long[n2];
		dp[0] = 0;
		for (int i = 1; i < n2; i++) {
			for (int x = 0; x < n; x++) {
				for (int y = x + 1; y < n; y++) {
					if ((i >> x & 1) == 1 && (i >> y & 1) == 1) {
						dp[i] += a[x][y];
					}
				}
			}
			for (int j = (i - 1) & i; j > 0; j = (j - 1) & i) {
				dp[i] = Math.max(dp[i], dp[j] + dp[i - j]);
			}
		}
		System.out.println(dp[n2 - 1]);
	}
}


Measured memory_bytes: 38252
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A1 = sc.nextInt();
    int A2 = sc.nextInt();
    int A3 = sc.nextInt();
    sc.close();
    
    String ans = (A1 + A2 + A3) > 21 ? "bust" : "win";
    System.out.println(ans);
  }
}


Measured memory_bytes: 23764
#include<iostream>
using namespace std;
const int INF = 2000000;

int main() {
  int n;
  while (cin >> n and n != 0) {
    int* arr = new int[n];

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

    int val = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < i; j++)
        if (arr[j] > arr[i]) val++;

    cout << val << endl;
  }
}

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

using ll=long long;



void solve(){
    int a,b;
    cin>>a>>b;
    if(b%a==0){
        cout<<a+b<<endl;
    }else{
        cout<<b-a<<endl;
    }
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
using System;

namespace Bishop
{
    class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();
            String[] splitted = input.Split(' ');
            long H = long.Parse(splitted[0]);
            long W = long.Parse(splitted[1]);
            long answer = 0;
            if (H == 1 || W == 1)
            {
                answer = 1;
            }
            else
            {
                answer = Math.Max(H * W / 2, (H * W + 1) / 2);
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 11092
if __name__ == "__main__":
    n, m = map(int, input().split())
    result = {}
    for _ in range(m):
        p, s = input().split()
        p = int(p)

        if not p in result:
            result[p] = [s]
        else:
            result[p].append(s)
    
    seikai = 0
    pena = 0

    for key in result:
        ptr = 0
        while ptr < len(result[key]) and result[key][ptr] == 'WA':
            ptr += 1
        
        if ptr == len(result[key]):
            continue

        seikai += 1
        pena += ptr
    print(seikai, pena)

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int n, t[100], v[101], st[101];
    cin >> n;
    for(int i=0;i<n;i++) cin >> t[i];
    for(int i=0;i<n;i++) cin >> v[i];
    v[n] = 0;

    st[0] = 0;
    for(int i=1;i<=n;i++) st[i] = st[i-1] + t[i-1];

    int vel[40001];
    int pos = 0;
    vel[0] = 0;
    for(int i=1;i<=st[n]*2;i++){
        vel[i] = min(vel[i-1]+1, v[pos]*2);
        for(int j=pos+1;j<=n;j++) vel[i] = min(vel[i], v[j]*2 + 2*st[j]-i);
        if(i == st[pos+1]*2) pos++;
    }

    double ans = 0;
    for(int i=1;i<=st[n]*2;i++){
        if(vel[i-1] != vel[i]) ans += 1;
        ans += min(vel[i-1], vel[i]) * 2;        
    }
    cout << ans/8 << endl;
    return 0;
}


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

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

Measured memory_bytes: 3844
N = int(input())
if N == 0:
    print(2)
    exit()
if N == 1:
    print(1)
    exit()

lucas = [0 for _ in range(N+1)]
lucas[0], lucas[1] = 2, 1
for n in range(2, N+1):
    lucas[n] = lucas[n-1] + lucas[n-2]
print(lucas[n])

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

vector<vector<int> > G;

vector<int> bfs(int s, int n) {
  queue<int> que;
  vector<int> dist(n,0);
  que.push(s); 
  dist[s] = 0;
  while(!que.empty()) {
    int u = que.front();
    que.pop();

    for (auto v : G[u]) {
      if (dist[v] != 0) continue;
      dist[v] = dist[u] + 1;
      que.push(v);
    }
  }
  return dist;
}

int main(){
  int n;
  cin >> n;
  G.resize(n);
  rep(i,n-1) {
    int a,b;
    cin >> a >> b;
    --a;--b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  auto df = bfs(0,n);
  auto ds = bfs(n-1,n);
  int res = 0;
  rep(i,n) {
    res += df[i] <= ds[i] ? 1 : -1;
  }
  if(res > 0) puts("Fennec");
  else puts("Snuke");

  return 0;
}

Measured memory_bytes: 6528
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
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;}
int nxt() {int x;scanf("%d", &x);return x;}

const int nax = 1e5;
int memo[nax], stone[nax];

int dp(int i){
    if (i == 0) return 0;
    if (i < 0) return INF;
    if (memo[i] != -1) return memo[i];
    int ans = min(dp(i-1) + abs(stone[i]-stone[i-1]), dp(i-2) + abs(stone[i]-stone[i-2]));
    return memo[i] = ans;
}

int main(){
    memset(memo, -1, sizeof memo);
    int n = nxt();
    REP(i, n)
    stone[i] = nxt();
    printf("%d\n", dp(n - 1));
    return 0;
}



Measured memory_bytes: 6852
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean card[]=new boolean[11];
		int c1,c2,c3,i,j,sum;
		double p;
		while(sc.hasNext()){
			double count=0;
			Arrays.fill(card, true);
			c1=sc.nextInt();
			c2=sc.nextInt();
			c3=sc.nextInt();
			card[c1]=false;
			card[c2]=false;
			card[c3]=false;
			sum=c1+c2;
			j=20-sum;
			for(i=1;i<11;i++){
				if(card[i] && i<=j){
					count++;
				}
			}
			p=count/7;
			if(p>=0.5){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}//while
	}
}

Measured memory_bytes: 11000
package main

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

var facts []int

func main() {
	// fetch
	N := readint()
	facts = make([]int, N)
	_ = facts[N-1]
	P := make([]int, N)
	for i := 0; i < N; i++ {
		P[i] = readint()
	}
	Q := make([]int, N)
	for i := 0; i < N; i++ {
		Q[i] = readint()
	}
	// calc
	pp := 1
	qp := 1
	for i := 0; i < N; i++ {
		p := append([]int{}, P[i:]...)
		q := append([]int{}, Q[i:]...)
		sort.Sort(sort.IntSlice(p))
		sort.Sort(sort.IntSlice(q))
		pi := sort.SearchInts(p, P[i])
		qi := sort.SearchInts(q, Q[i])
		pp += pi * factorial(N-i-1)
		qp += qi * factorial(N-i-1)
		//fmt.Println(pp, qp)
	}
	fmt.Println(absub(pp, qp))
}

func absub(a, b int) int {
	if a < b {
		return b - a
	}
	return a - b
}

func factorial(n int) (res int) {
	if facts[n] != 0 {
		res = facts[n]
		return res
	}

	if n > 0 {
		res = n * factorial(n-1)
		return res
	}

	return 1
}

const (
	iobufsize = 1 * 1024 * 1024 // 1 MB
)

var stdinsc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, iobufsize), iobufsize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func readint() int {
	stdinsc.Scan()
	v, err := strconv.Atoi(stdinsc.Text())
	if err != nil {
		panic(err)
	}
	return v
}

func readstr() string {
	stdinsc.Scan()
	return stdinsc.Text()
}

func pow(x, y int) int {
	if y < 1 {
		return 1
	}
	return x * pow(x, y-1)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int n, m;
vector<int> es[8];

bool ved[8];

int dfs(int v, int rem) {
	if (rem == 0) return 1;
	int res = 0;
	REP(i, es[v].size()) if (!ved[es[v][i]]) {
		ved[es[v][i]] = true;
		res += dfs(es[v][i], rem - 1);
		ved[es[v][i]] = false;
	}
	return res;
}

int main(int argc, char **argv) {
	cin >> n >> m;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		es[a].push_back(b);
		es[b].push_back(a);
	}
	CLEAR(ved);
	ved[0] = true;
	cout << dfs(0, n - 1) << endl;
	return 0;
}


Measured memory_bytes: 256